C++ Easy Implementation
\nclass Solution {\npublic:\n    vector<int> v;\n    vector<vector<int>> rect;\n    Solution(vector<vector<int>>& rects) \n    {\n        rect=rects;\n        i
```\nclass Solution {\npublic:\n    vector<int> v;\n    vector<vector<int>> rect;\n    Solution(vector<vector<int>>& rects) \n    {\n        rect=rects;\n        int area=0;\n        for(auto rec:rect)\n        {\n            int a= (rec[2]- rec[0]+1)*(rec[3]-rec[1]+1);\n            area+=a;\n            v.push_back(area);\n        }\n    }\n    \n    vector<int> pick() \n    {\n        int rnd= rand()%v.back();\n        int idx= upper_bound(v.begin(),v.end(),rnd) - v.begin();\n        \n        auto l=rect[idx];\n        int x= rand() % (l[2]-l[0]+1) + l[0];\n        int y= rand() % (l[3]-l[1]+1) + l[1];\n        return {x,y};\n    }\n};\n```
[]