#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';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
5 ms |
340 KB |
Output is correct |
8 |
Correct |
5 ms |
420 KB |
Output is correct |
9 |
Correct |
7 ms |
340 KB |
Output is correct |
10 |
Correct |
4 ms |
340 KB |
Output is correct |
11 |
Correct |
4 ms |
340 KB |
Output is correct |
12 |
Correct |
4 ms |
340 KB |
Output is correct |
13 |
Correct |
4 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
340 KB |
Output is correct |
15 |
Correct |
4 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
416 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2670 ms |
3160 KB |
Output is correct |
2 |
Correct |
2736 ms |
3160 KB |
Output is correct |
3 |
Correct |
2643 ms |
3164 KB |
Output is correct |
4 |
Correct |
2624 ms |
3148 KB |
Output is correct |
5 |
Correct |
2634 ms |
3164 KB |
Output is correct |
6 |
Correct |
2655 ms |
3204 KB |
Output is correct |
7 |
Correct |
2652 ms |
3168 KB |
Output is correct |
8 |
Correct |
2661 ms |
3164 KB |
Output is correct |
9 |
Correct |
2765 ms |
3164 KB |
Output is correct |
10 |
Correct |
2633 ms |
3032 KB |
Output is correct |
11 |
Correct |
2676 ms |
3040 KB |
Output is correct |
12 |
Correct |
2783 ms |
2804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2670 ms |
3160 KB |
Output is correct |
2 |
Correct |
2736 ms |
3160 KB |
Output is correct |
3 |
Correct |
2643 ms |
3164 KB |
Output is correct |
4 |
Correct |
2624 ms |
3148 KB |
Output is correct |
5 |
Correct |
2634 ms |
3164 KB |
Output is correct |
6 |
Correct |
2655 ms |
3204 KB |
Output is correct |
7 |
Correct |
2652 ms |
3168 KB |
Output is correct |
8 |
Correct |
2661 ms |
3164 KB |
Output is correct |
9 |
Correct |
2765 ms |
3164 KB |
Output is correct |
10 |
Correct |
2633 ms |
3032 KB |
Output is correct |
11 |
Correct |
2676 ms |
3040 KB |
Output is correct |
12 |
Correct |
2783 ms |
2804 KB |
Output is correct |
13 |
Correct |
2889 ms |
3164 KB |
Output is correct |
14 |
Correct |
2923 ms |
3160 KB |
Output is correct |
15 |
Execution timed out |
3099 ms |
2636 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
5 ms |
340 KB |
Output is correct |
8 |
Correct |
5 ms |
420 KB |
Output is correct |
9 |
Correct |
7 ms |
340 KB |
Output is correct |
10 |
Correct |
4 ms |
340 KB |
Output is correct |
11 |
Correct |
4 ms |
340 KB |
Output is correct |
12 |
Correct |
4 ms |
340 KB |
Output is correct |
13 |
Correct |
4 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
340 KB |
Output is correct |
15 |
Correct |
4 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
416 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Correct |
2670 ms |
3160 KB |
Output is correct |
20 |
Correct |
2736 ms |
3160 KB |
Output is correct |
21 |
Correct |
2643 ms |
3164 KB |
Output is correct |
22 |
Correct |
2624 ms |
3148 KB |
Output is correct |
23 |
Correct |
2634 ms |
3164 KB |
Output is correct |
24 |
Correct |
2655 ms |
3204 KB |
Output is correct |
25 |
Correct |
2652 ms |
3168 KB |
Output is correct |
26 |
Correct |
2661 ms |
3164 KB |
Output is correct |
27 |
Correct |
2765 ms |
3164 KB |
Output is correct |
28 |
Correct |
2633 ms |
3032 KB |
Output is correct |
29 |
Correct |
2676 ms |
3040 KB |
Output is correct |
30 |
Correct |
2783 ms |
2804 KB |
Output is correct |
31 |
Correct |
2889 ms |
3164 KB |
Output is correct |
32 |
Correct |
2923 ms |
3160 KB |
Output is correct |
33 |
Execution timed out |
3099 ms |
2636 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |