#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();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15964 KB |
Output is correct |
3 |
Correct |
4 ms |
15964 KB |
Output is correct |
4 |
Correct |
4 ms |
16108 KB |
Output is correct |
5 |
Correct |
6 ms |
15964 KB |
Output is correct |
6 |
Correct |
6 ms |
16012 KB |
Output is correct |
7 |
Correct |
4 ms |
15964 KB |
Output is correct |
8 |
Correct |
5 ms |
15964 KB |
Output is correct |
9 |
Correct |
5 ms |
15964 KB |
Output is correct |
10 |
Correct |
7 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15964 KB |
Output is correct |
13 |
Correct |
4 ms |
16216 KB |
Output is correct |
14 |
Correct |
5 ms |
15964 KB |
Output is correct |
15 |
Correct |
18 ms |
15964 KB |
Output is correct |
16 |
Correct |
24 ms |
15960 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
14 ms |
15964 KB |
Output is correct |
19 |
Correct |
19 ms |
15964 KB |
Output is correct |
20 |
Correct |
11 ms |
15964 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
19 ms |
15964 KB |
Output is correct |
23 |
Correct |
13 ms |
15964 KB |
Output is correct |
24 |
Correct |
13 ms |
15964 KB |
Output is correct |
25 |
Correct |
9 ms |
15964 KB |
Output is correct |
26 |
Correct |
4 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15964 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15964 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15964 KB |
Output is correct |
3 |
Correct |
4 ms |
15964 KB |
Output is correct |
4 |
Correct |
4 ms |
16108 KB |
Output is correct |
5 |
Correct |
6 ms |
15964 KB |
Output is correct |
6 |
Correct |
6 ms |
16012 KB |
Output is correct |
7 |
Correct |
4 ms |
15964 KB |
Output is correct |
8 |
Correct |
5 ms |
15964 KB |
Output is correct |
9 |
Correct |
5 ms |
15964 KB |
Output is correct |
10 |
Correct |
7 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15964 KB |
Output is correct |
13 |
Correct |
4 ms |
16216 KB |
Output is correct |
14 |
Correct |
5 ms |
15964 KB |
Output is correct |
15 |
Correct |
18 ms |
15964 KB |
Output is correct |
16 |
Correct |
24 ms |
15960 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
14 ms |
15964 KB |
Output is correct |
19 |
Correct |
19 ms |
15964 KB |
Output is correct |
20 |
Correct |
11 ms |
15964 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
19 ms |
15964 KB |
Output is correct |
23 |
Correct |
13 ms |
15964 KB |
Output is correct |
24 |
Correct |
13 ms |
15964 KB |
Output is correct |
25 |
Correct |
9 ms |
15964 KB |
Output is correct |
26 |
Correct |
4 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15964 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15964 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
31 |
Execution timed out |
5019 ms |
18136 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5042 ms |
24152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5078 ms |
23632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15964 KB |
Output is correct |
3 |
Correct |
4 ms |
15964 KB |
Output is correct |
4 |
Correct |
4 ms |
16108 KB |
Output is correct |
5 |
Correct |
6 ms |
15964 KB |
Output is correct |
6 |
Correct |
6 ms |
16012 KB |
Output is correct |
7 |
Correct |
4 ms |
15964 KB |
Output is correct |
8 |
Correct |
5 ms |
15964 KB |
Output is correct |
9 |
Correct |
5 ms |
15964 KB |
Output is correct |
10 |
Correct |
7 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15964 KB |
Output is correct |
13 |
Correct |
4 ms |
16216 KB |
Output is correct |
14 |
Correct |
5 ms |
15964 KB |
Output is correct |
15 |
Correct |
18 ms |
15964 KB |
Output is correct |
16 |
Correct |
24 ms |
15960 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
14 ms |
15964 KB |
Output is correct |
19 |
Correct |
19 ms |
15964 KB |
Output is correct |
20 |
Correct |
11 ms |
15964 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
19 ms |
15964 KB |
Output is correct |
23 |
Correct |
13 ms |
15964 KB |
Output is correct |
24 |
Correct |
13 ms |
15964 KB |
Output is correct |
25 |
Correct |
9 ms |
15964 KB |
Output is correct |
26 |
Correct |
4 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15964 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15964 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
31 |
Execution timed out |
5019 ms |
18136 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
15964 KB |
Output is correct |
2 |
Correct |
5 ms |
15964 KB |
Output is correct |
3 |
Correct |
4 ms |
15964 KB |
Output is correct |
4 |
Correct |
4 ms |
16108 KB |
Output is correct |
5 |
Correct |
6 ms |
15964 KB |
Output is correct |
6 |
Correct |
6 ms |
16012 KB |
Output is correct |
7 |
Correct |
4 ms |
15964 KB |
Output is correct |
8 |
Correct |
5 ms |
15964 KB |
Output is correct |
9 |
Correct |
5 ms |
15964 KB |
Output is correct |
10 |
Correct |
7 ms |
15964 KB |
Output is correct |
11 |
Correct |
4 ms |
15964 KB |
Output is correct |
12 |
Correct |
5 ms |
15964 KB |
Output is correct |
13 |
Correct |
4 ms |
16216 KB |
Output is correct |
14 |
Correct |
5 ms |
15964 KB |
Output is correct |
15 |
Correct |
18 ms |
15964 KB |
Output is correct |
16 |
Correct |
24 ms |
15960 KB |
Output is correct |
17 |
Correct |
10 ms |
15964 KB |
Output is correct |
18 |
Correct |
14 ms |
15964 KB |
Output is correct |
19 |
Correct |
19 ms |
15964 KB |
Output is correct |
20 |
Correct |
11 ms |
15964 KB |
Output is correct |
21 |
Correct |
46 ms |
15964 KB |
Output is correct |
22 |
Correct |
19 ms |
15964 KB |
Output is correct |
23 |
Correct |
13 ms |
15964 KB |
Output is correct |
24 |
Correct |
13 ms |
15964 KB |
Output is correct |
25 |
Correct |
9 ms |
15964 KB |
Output is correct |
26 |
Correct |
4 ms |
15964 KB |
Output is correct |
27 |
Correct |
6 ms |
15964 KB |
Output is correct |
28 |
Correct |
5 ms |
15964 KB |
Output is correct |
29 |
Correct |
5 ms |
15964 KB |
Output is correct |
30 |
Correct |
4 ms |
15964 KB |
Output is correct |
31 |
Execution timed out |
5019 ms |
18136 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |