#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 5, MOD = 998244353;
int n,q,k;
vector<array<int,4>> a(N);
void test(){
cin >> n >> k >> q;
for(int i = 1;i <= n;i++){
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
}
for(int i = 1;i <= q;i++){
int y,l;
cin >> l >> y;
int res = 0;
for(int j = 1;j <= k;j++){
int mn = 1e9;
for(int x = 1;x <= n;x++){
if(a[x][1] == j && a[x][2] <= y && a[x][3] >= y){
mn = min(mn,abs(a[x][0] - l));
}
}
if(mn == 1e9){
res=-1;
break;
}
res = max(res,mn);
}
cout << res << '\n';
}
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int T = 1;
// cin >> T;
while (T--){
test();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15960 KB |
Output is correct |
3 |
Correct |
4 ms |
15960 KB |
Output is correct |
4 |
Correct |
4 ms |
15964 KB |
Output is correct |
5 |
Correct |
5 ms |
15960 KB |
Output is correct |
6 |
Correct |
6 ms |
16124 KB |
Output is correct |
7 |
Correct |
4 ms |
16072 KB |
Output is correct |
8 |
Correct |
5 ms |
15960 KB |
Output is correct |
9 |
Correct |
4 ms |
15960 KB |
Output is correct |
10 |
Correct |
6 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15944 KB |
Output is correct |
13 |
Correct |
4 ms |
15960 KB |
Output is correct |
14 |
Correct |
4 ms |
15960 KB |
Output is correct |
15 |
Correct |
18 ms |
16136 KB |
Output is correct |
16 |
Correct |
24 ms |
15964 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
15 ms |
16128 KB |
Output is correct |
19 |
Correct |
19 ms |
15960 KB |
Output is correct |
20 |
Correct |
9 ms |
16128 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
26 ms |
15960 KB |
Output is correct |
23 |
Correct |
12 ms |
15960 KB |
Output is correct |
24 |
Correct |
12 ms |
15964 KB |
Output is correct |
25 |
Correct |
8 ms |
15964 KB |
Output is correct |
26 |
Correct |
5 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15960 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15884 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15960 KB |
Output is correct |
3 |
Correct |
4 ms |
15960 KB |
Output is correct |
4 |
Correct |
4 ms |
15964 KB |
Output is correct |
5 |
Correct |
5 ms |
15960 KB |
Output is correct |
6 |
Correct |
6 ms |
16124 KB |
Output is correct |
7 |
Correct |
4 ms |
16072 KB |
Output is correct |
8 |
Correct |
5 ms |
15960 KB |
Output is correct |
9 |
Correct |
4 ms |
15960 KB |
Output is correct |
10 |
Correct |
6 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15944 KB |
Output is correct |
13 |
Correct |
4 ms |
15960 KB |
Output is correct |
14 |
Correct |
4 ms |
15960 KB |
Output is correct |
15 |
Correct |
18 ms |
16136 KB |
Output is correct |
16 |
Correct |
24 ms |
15964 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
15 ms |
16128 KB |
Output is correct |
19 |
Correct |
19 ms |
15960 KB |
Output is correct |
20 |
Correct |
9 ms |
16128 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
26 ms |
15960 KB |
Output is correct |
23 |
Correct |
12 ms |
15960 KB |
Output is correct |
24 |
Correct |
12 ms |
15964 KB |
Output is correct |
25 |
Correct |
8 ms |
15964 KB |
Output is correct |
26 |
Correct |
5 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15960 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15884 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
31 |
Execution timed out |
5099 ms |
16104 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5028 ms |
15964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5042 ms |
15964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15960 KB |
Output is correct |
3 |
Correct |
4 ms |
15960 KB |
Output is correct |
4 |
Correct |
4 ms |
15964 KB |
Output is correct |
5 |
Correct |
5 ms |
15960 KB |
Output is correct |
6 |
Correct |
6 ms |
16124 KB |
Output is correct |
7 |
Correct |
4 ms |
16072 KB |
Output is correct |
8 |
Correct |
5 ms |
15960 KB |
Output is correct |
9 |
Correct |
4 ms |
15960 KB |
Output is correct |
10 |
Correct |
6 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15944 KB |
Output is correct |
13 |
Correct |
4 ms |
15960 KB |
Output is correct |
14 |
Correct |
4 ms |
15960 KB |
Output is correct |
15 |
Correct |
18 ms |
16136 KB |
Output is correct |
16 |
Correct |
24 ms |
15964 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
15 ms |
16128 KB |
Output is correct |
19 |
Correct |
19 ms |
15960 KB |
Output is correct |
20 |
Correct |
9 ms |
16128 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
26 ms |
15960 KB |
Output is correct |
23 |
Correct |
12 ms |
15960 KB |
Output is correct |
24 |
Correct |
12 ms |
15964 KB |
Output is correct |
25 |
Correct |
8 ms |
15964 KB |
Output is correct |
26 |
Correct |
5 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15960 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15884 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
31 |
Execution timed out |
5099 ms |
16104 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15960 KB |
Output is correct |
3 |
Correct |
4 ms |
15960 KB |
Output is correct |
4 |
Correct |
4 ms |
15964 KB |
Output is correct |
5 |
Correct |
5 ms |
15960 KB |
Output is correct |
6 |
Correct |
6 ms |
16124 KB |
Output is correct |
7 |
Correct |
4 ms |
16072 KB |
Output is correct |
8 |
Correct |
5 ms |
15960 KB |
Output is correct |
9 |
Correct |
4 ms |
15960 KB |
Output is correct |
10 |
Correct |
6 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15944 KB |
Output is correct |
13 |
Correct |
4 ms |
15960 KB |
Output is correct |
14 |
Correct |
4 ms |
15960 KB |
Output is correct |
15 |
Correct |
18 ms |
16136 KB |
Output is correct |
16 |
Correct |
24 ms |
15964 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
15 ms |
16128 KB |
Output is correct |
19 |
Correct |
19 ms |
15960 KB |
Output is correct |
20 |
Correct |
9 ms |
16128 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
26 ms |
15960 KB |
Output is correct |
23 |
Correct |
12 ms |
15960 KB |
Output is correct |
24 |
Correct |
12 ms |
15964 KB |
Output is correct |
25 |
Correct |
8 ms |
15964 KB |
Output is correct |
26 |
Correct |
5 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15960 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15884 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
31 |
Execution timed out |
5099 ms |
16104 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |