/******************************
Author: jhnah917(Justice_Hui)
g++ -std=c++17 -DLOCAL
******************************/
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define IDX(v, x) lower_bound(all(v), x) - v.begin()
using namespace std;
using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
constexpr int SZ = 1 << 17;
int N, Q;
alignas(256) int S[SZ], T[SZ], Sum[SZ];
alignas(256) char Flags[SZ];
int main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cin >> N >> Q;
for(int i=1; i<=N; i++) cin >> S[i] >> T[i];
for(int i=1; i<=N; i++) Sum[i] = S[i] + T[i];
for(int i=1; i<=Q; i++){
int x, y, z, ans = 0; cin >> x >> y >> z;
memset(Flags+1, 0, sizeof(char) * N);
for(int j=1; j<=N; j++) if(S[j] >= x) Flags[j] |= 1;
for(int j=1; j<=N; j++) if(T[j] >= y) Flags[j] |= 2;
for(int j=1; j<=N; j++) if(Sum[j] >= z) Flags[j] |= 4;
for(int j=1; j<=N; j++) ans += Flags[j] == 7;
cout << ans << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
12 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
620 KB |
Output is correct |
9 |
Correct |
12 ms |
668 KB |
Output is correct |
10 |
Correct |
12 ms |
492 KB |
Output is correct |
11 |
Correct |
11 ms |
492 KB |
Output is correct |
12 |
Correct |
11 ms |
492 KB |
Output is correct |
13 |
Correct |
12 ms |
512 KB |
Output is correct |
14 |
Correct |
12 ms |
492 KB |
Output is correct |
15 |
Correct |
12 ms |
492 KB |
Output is correct |
16 |
Correct |
13 ms |
512 KB |
Output is correct |
17 |
Correct |
14 ms |
492 KB |
Output is correct |
18 |
Correct |
11 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3063 ms |
4040 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3063 ms |
4040 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
12 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
620 KB |
Output is correct |
9 |
Correct |
12 ms |
668 KB |
Output is correct |
10 |
Correct |
12 ms |
492 KB |
Output is correct |
11 |
Correct |
11 ms |
492 KB |
Output is correct |
12 |
Correct |
11 ms |
492 KB |
Output is correct |
13 |
Correct |
12 ms |
512 KB |
Output is correct |
14 |
Correct |
12 ms |
492 KB |
Output is correct |
15 |
Correct |
12 ms |
492 KB |
Output is correct |
16 |
Correct |
13 ms |
512 KB |
Output is correct |
17 |
Correct |
14 ms |
492 KB |
Output is correct |
18 |
Correct |
11 ms |
492 KB |
Output is correct |
19 |
Execution timed out |
3063 ms |
4040 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |