#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, k, q, x[N], t[N], a[N], b[N], type[N], l, r;
int main () {
// freopen ("input.txt", "r", stdin);
cin >> n >> k >> q;
for (int i = 1; i <= n; ++i) {
cin >> x[i] >> t[i] >> a[i] >> b[i];
}
while ( q-- ) {
cin >> l >> r;
for (int i = 1; i <= k; ++i) {
type[i] = -1;
}
for (int i = 1; i <= n; ++i) {
if (a[i] <= r and r <= b[i]) {
if (type[t[i]] == -1) {
type[t[i]] = abs (l - x[i]);
}
else {
type[t[i]] = min (type[t[i]], abs (l - x[i]));
}
}
}
int jog = 0;
for (int i = 1; i <= k; ++i) {
jog = max (jog, type[i]);
if (type[i] == -1) {
jog = -1;
break;
}
}
cout << jog << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4696 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
2 ms |
4444 KB |
Output is correct |
6 |
Correct |
3 ms |
4444 KB |
Output is correct |
7 |
Correct |
2 ms |
4440 KB |
Output is correct |
8 |
Correct |
3 ms |
4444 KB |
Output is correct |
9 |
Correct |
3 ms |
4440 KB |
Output is correct |
10 |
Correct |
3 ms |
4552 KB |
Output is correct |
11 |
Correct |
2 ms |
4444 KB |
Output is correct |
12 |
Correct |
2 ms |
4548 KB |
Output is correct |
13 |
Correct |
2 ms |
4444 KB |
Output is correct |
14 |
Correct |
2 ms |
4444 KB |
Output is correct |
15 |
Correct |
3 ms |
4456 KB |
Output is correct |
16 |
Correct |
3 ms |
4444 KB |
Output is correct |
17 |
Correct |
2 ms |
4444 KB |
Output is correct |
18 |
Correct |
3 ms |
4444 KB |
Output is correct |
19 |
Correct |
3 ms |
4444 KB |
Output is correct |
20 |
Correct |
3 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4552 KB |
Output is correct |
22 |
Correct |
2 ms |
4444 KB |
Output is correct |
23 |
Correct |
2 ms |
4444 KB |
Output is correct |
24 |
Correct |
2 ms |
4440 KB |
Output is correct |
25 |
Correct |
2 ms |
4440 KB |
Output is correct |
26 |
Correct |
2 ms |
4440 KB |
Output is correct |
27 |
Correct |
2 ms |
4444 KB |
Output is correct |
28 |
Correct |
3 ms |
4812 KB |
Output is correct |
29 |
Correct |
2 ms |
4444 KB |
Output is correct |
30 |
Correct |
2 ms |
4444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4696 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
2 ms |
4444 KB |
Output is correct |
6 |
Correct |
3 ms |
4444 KB |
Output is correct |
7 |
Correct |
2 ms |
4440 KB |
Output is correct |
8 |
Correct |
3 ms |
4444 KB |
Output is correct |
9 |
Correct |
3 ms |
4440 KB |
Output is correct |
10 |
Correct |
3 ms |
4552 KB |
Output is correct |
11 |
Correct |
2 ms |
4444 KB |
Output is correct |
12 |
Correct |
2 ms |
4548 KB |
Output is correct |
13 |
Correct |
2 ms |
4444 KB |
Output is correct |
14 |
Correct |
2 ms |
4444 KB |
Output is correct |
15 |
Correct |
3 ms |
4456 KB |
Output is correct |
16 |
Correct |
3 ms |
4444 KB |
Output is correct |
17 |
Correct |
2 ms |
4444 KB |
Output is correct |
18 |
Correct |
3 ms |
4444 KB |
Output is correct |
19 |
Correct |
3 ms |
4444 KB |
Output is correct |
20 |
Correct |
3 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4552 KB |
Output is correct |
22 |
Correct |
2 ms |
4444 KB |
Output is correct |
23 |
Correct |
2 ms |
4444 KB |
Output is correct |
24 |
Correct |
2 ms |
4440 KB |
Output is correct |
25 |
Correct |
2 ms |
4440 KB |
Output is correct |
26 |
Correct |
2 ms |
4440 KB |
Output is correct |
27 |
Correct |
2 ms |
4444 KB |
Output is correct |
28 |
Correct |
3 ms |
4812 KB |
Output is correct |
29 |
Correct |
2 ms |
4444 KB |
Output is correct |
30 |
Correct |
2 ms |
4444 KB |
Output is correct |
31 |
Execution timed out |
5051 ms |
7512 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5049 ms |
14320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5023 ms |
13756 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4696 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
2 ms |
4444 KB |
Output is correct |
6 |
Correct |
3 ms |
4444 KB |
Output is correct |
7 |
Correct |
2 ms |
4440 KB |
Output is correct |
8 |
Correct |
3 ms |
4444 KB |
Output is correct |
9 |
Correct |
3 ms |
4440 KB |
Output is correct |
10 |
Correct |
3 ms |
4552 KB |
Output is correct |
11 |
Correct |
2 ms |
4444 KB |
Output is correct |
12 |
Correct |
2 ms |
4548 KB |
Output is correct |
13 |
Correct |
2 ms |
4444 KB |
Output is correct |
14 |
Correct |
2 ms |
4444 KB |
Output is correct |
15 |
Correct |
3 ms |
4456 KB |
Output is correct |
16 |
Correct |
3 ms |
4444 KB |
Output is correct |
17 |
Correct |
2 ms |
4444 KB |
Output is correct |
18 |
Correct |
3 ms |
4444 KB |
Output is correct |
19 |
Correct |
3 ms |
4444 KB |
Output is correct |
20 |
Correct |
3 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4552 KB |
Output is correct |
22 |
Correct |
2 ms |
4444 KB |
Output is correct |
23 |
Correct |
2 ms |
4444 KB |
Output is correct |
24 |
Correct |
2 ms |
4440 KB |
Output is correct |
25 |
Correct |
2 ms |
4440 KB |
Output is correct |
26 |
Correct |
2 ms |
4440 KB |
Output is correct |
27 |
Correct |
2 ms |
4444 KB |
Output is correct |
28 |
Correct |
3 ms |
4812 KB |
Output is correct |
29 |
Correct |
2 ms |
4444 KB |
Output is correct |
30 |
Correct |
2 ms |
4444 KB |
Output is correct |
31 |
Execution timed out |
5051 ms |
7512 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4696 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
2 ms |
4444 KB |
Output is correct |
6 |
Correct |
3 ms |
4444 KB |
Output is correct |
7 |
Correct |
2 ms |
4440 KB |
Output is correct |
8 |
Correct |
3 ms |
4444 KB |
Output is correct |
9 |
Correct |
3 ms |
4440 KB |
Output is correct |
10 |
Correct |
3 ms |
4552 KB |
Output is correct |
11 |
Correct |
2 ms |
4444 KB |
Output is correct |
12 |
Correct |
2 ms |
4548 KB |
Output is correct |
13 |
Correct |
2 ms |
4444 KB |
Output is correct |
14 |
Correct |
2 ms |
4444 KB |
Output is correct |
15 |
Correct |
3 ms |
4456 KB |
Output is correct |
16 |
Correct |
3 ms |
4444 KB |
Output is correct |
17 |
Correct |
2 ms |
4444 KB |
Output is correct |
18 |
Correct |
3 ms |
4444 KB |
Output is correct |
19 |
Correct |
3 ms |
4444 KB |
Output is correct |
20 |
Correct |
3 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4552 KB |
Output is correct |
22 |
Correct |
2 ms |
4444 KB |
Output is correct |
23 |
Correct |
2 ms |
4444 KB |
Output is correct |
24 |
Correct |
2 ms |
4440 KB |
Output is correct |
25 |
Correct |
2 ms |
4440 KB |
Output is correct |
26 |
Correct |
2 ms |
4440 KB |
Output is correct |
27 |
Correct |
2 ms |
4444 KB |
Output is correct |
28 |
Correct |
3 ms |
4812 KB |
Output is correct |
29 |
Correct |
2 ms |
4444 KB |
Output is correct |
30 |
Correct |
2 ms |
4444 KB |
Output is correct |
31 |
Execution timed out |
5051 ms |
7512 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |