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;
#ifdef ONPC
#include"debug.h"
#else
#define debug(...) 42
#endif
#define endl '\n'
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
const int mod = 1e9 + 7;
const int MAXN = 1e6 + 15;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
vector<int> ans[MAXN];
struct point {
int x, y;
};
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, q;
cin >> n >> q;
vector<point> a(n);
for (int i = 0; i < n; i++){
cin >> a[i].x >> a[i].y;
}
vector<array<int, 3>> queries(q);
vector<array<int, 3>> queriesA(q);
vector<array<int, 3>> queriesB(q);
for (int i = 0; i < q; i++){
cin >> queries[i][0] >> queries[i][1] >> queries[i][2];
queries[i][2] = max(queries[i][2], queries[i][0] + queries[i][1]);
queriesA[i] = {queries[i][2], queries[i][0], i};
queriesB[i] = {queries[i][2], queries[i][1], i};
}
//sort(all(a));
for (int i = 0; i < q; i++){// solve for b
for (int j = 0; j < n; j++){
if (a[j].x + a[j].y >= queriesA[i][0] && a[j].x < queriesA[i][1]) ans[queriesA[i][2]].pb(j);
}
}
for (int i = 0; i < q; i++){// solve for b
for (int j = 0; j < n; j++){
if (a[j].x + a[j].y >= queriesB[i][0] && a[j].y < queriesB[i][1]) ans[queriesB[i][2]].pb(j);
}
}
for (int i = 0; i < q; i++){// solve for c
for (int j = 0; j < n; j++){
if (a[j].x + a[j].y < queries[i][2]) ans[queriesB[i][2]].pb(j);
}
}
for (int i = 0; i < q; i++){
sort(all(ans[i]));
debug(ans[i]);
}
for (int i = 0; i < q; i++){
cout << n - sz(ans[i]) << endl;
}
}
Compilation message (stderr)
examination.cpp: In function 'int main()':
examination.cpp:6:20: warning: statement has no effect [-Wunused-value]
6 | #define debug(...) 42
| ^~
examination.cpp:62:3: note: in expansion of macro 'debug'
62 | debug(ans[i]);
| ^~~~~
# | 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... |