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>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx")
const int N = 100'010;
int a[N], b[N];
int ans[N];
int x[N], y[N], z[N];
const int S = 4096;
int n, q;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
cin >> n >> q;
Loop (i,0,n)
cin >> a[i] >> b[i];
Loop (i,0,q)
cin >> x[i] >> y[i] >> z[i];
for (int l = 0; l < n; l += S) {
int r = min(l+S, n);
Loop (i,0,q) {
int x=::x[i],y=::y[i],z=::z[i];
int ans = 0;
Loop (i,l,r) {
int t1 = -(a[i]>=x);
int t2 = -(b[i]>=y);
int t3 = -(a[i]+b[i]>=z);
ans -= t1 & t2 & t3;
}
::ans[i] += ans;
}
}
Loop (i,0,q)
cout << ans[i] << '\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... |