This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
struct Rectangle{
int x1, y1, x2, y2;
};
struct Point{
int x, y, color_id;
};
bool IsInside(Point p, Rectangle r){
return (p.x >= r.x1 && p.x <= r.x2 && p.y >= r.y1 && p.y <= r.y2);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<Rectangle>rectangles(n);
for(int i = 0;i < n;++i){
cin >> rectangles[i].x1 >> rectangles[i].y1 >> rectangles[i].x2 >> rectangles[i].y2;
}
vector<Point>points(m);
for(int i = 0;i < m;++i){
cin >> points[i].x >> points[i].y >> points[i].color_id;
}
vector<unordered_set<int>>num_of_diff_colors(n);
for(int i = 0;i < m;++i){
for(int j = 0;j < n;++j){
if(IsInside(points[i], rectangles[j])){
num_of_diff_colors[j].insert(points[i].color_id);
}
}
}
for(int i = 0;i < n;++i){
cout << num_of_diff_colors[i].size() << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |