#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e5 + 20;
const int mod = 1e9 + 7;
int x[maxn], t[maxn], a[maxn], b[maxn];
int mn[maxn];
int main(){
ios_base::sync_with_stdio(false);
int n, k, q;
cin >> n >> k >> q;
for (int i = 1; i <= n; i++)
cin >> x[i] >> t[i] >> a[i] >> b[i];
for (int i = 1; i <= q; i++){
int l, y;
cin >> l >> y;
memset(mn, -1, sizeof mn);
for (int j = 1; j <= n; j++){
if (y < a[j] or b[j] < y)
continue;
if (mn[t[j]] == -1 or mn[t[j]] > abs(l-x[j]))
mn[t[j]] = abs(l-x[j]);
}
if (*min_element(mn+1, mn+k+1) == -1)
cout << -1 << '\n';
else
cout << *max_element(mn+1, mn+k+1) << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1536 KB |
Output is correct |
4 |
Correct |
2 ms |
1536 KB |
Output is correct |
5 |
Correct |
16 ms |
1536 KB |
Output is correct |
6 |
Correct |
17 ms |
1536 KB |
Output is correct |
7 |
Correct |
16 ms |
1536 KB |
Output is correct |
8 |
Correct |
17 ms |
1536 KB |
Output is correct |
9 |
Correct |
17 ms |
1536 KB |
Output is correct |
10 |
Correct |
16 ms |
1536 KB |
Output is correct |
11 |
Correct |
16 ms |
1536 KB |
Output is correct |
12 |
Correct |
17 ms |
1536 KB |
Output is correct |
13 |
Correct |
16 ms |
1536 KB |
Output is correct |
14 |
Correct |
16 ms |
1536 KB |
Output is correct |
15 |
Correct |
16 ms |
1536 KB |
Output is correct |
16 |
Correct |
17 ms |
1536 KB |
Output is correct |
17 |
Correct |
17 ms |
1536 KB |
Output is correct |
18 |
Correct |
18 ms |
1536 KB |
Output is correct |
19 |
Correct |
17 ms |
1536 KB |
Output is correct |
20 |
Correct |
16 ms |
1536 KB |
Output is correct |
21 |
Correct |
27 ms |
1536 KB |
Output is correct |
22 |
Correct |
20 ms |
1536 KB |
Output is correct |
23 |
Correct |
17 ms |
1536 KB |
Output is correct |
24 |
Correct |
17 ms |
1536 KB |
Output is correct |
25 |
Correct |
16 ms |
1536 KB |
Output is correct |
26 |
Correct |
16 ms |
1536 KB |
Output is correct |
27 |
Correct |
17 ms |
1536 KB |
Output is correct |
28 |
Correct |
27 ms |
1536 KB |
Output is correct |
29 |
Correct |
16 ms |
1536 KB |
Output is correct |
30 |
Correct |
16 ms |
1536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1536 KB |
Output is correct |
4 |
Correct |
2 ms |
1536 KB |
Output is correct |
5 |
Correct |
16 ms |
1536 KB |
Output is correct |
6 |
Correct |
17 ms |
1536 KB |
Output is correct |
7 |
Correct |
16 ms |
1536 KB |
Output is correct |
8 |
Correct |
17 ms |
1536 KB |
Output is correct |
9 |
Correct |
17 ms |
1536 KB |
Output is correct |
10 |
Correct |
16 ms |
1536 KB |
Output is correct |
11 |
Correct |
16 ms |
1536 KB |
Output is correct |
12 |
Correct |
17 ms |
1536 KB |
Output is correct |
13 |
Correct |
16 ms |
1536 KB |
Output is correct |
14 |
Correct |
16 ms |
1536 KB |
Output is correct |
15 |
Correct |
16 ms |
1536 KB |
Output is correct |
16 |
Correct |
17 ms |
1536 KB |
Output is correct |
17 |
Correct |
17 ms |
1536 KB |
Output is correct |
18 |
Correct |
18 ms |
1536 KB |
Output is correct |
19 |
Correct |
17 ms |
1536 KB |
Output is correct |
20 |
Correct |
16 ms |
1536 KB |
Output is correct |
21 |
Correct |
27 ms |
1536 KB |
Output is correct |
22 |
Correct |
20 ms |
1536 KB |
Output is correct |
23 |
Correct |
17 ms |
1536 KB |
Output is correct |
24 |
Correct |
17 ms |
1536 KB |
Output is correct |
25 |
Correct |
16 ms |
1536 KB |
Output is correct |
26 |
Correct |
16 ms |
1536 KB |
Output is correct |
27 |
Correct |
17 ms |
1536 KB |
Output is correct |
28 |
Correct |
27 ms |
1536 KB |
Output is correct |
29 |
Correct |
16 ms |
1536 KB |
Output is correct |
30 |
Correct |
16 ms |
1536 KB |
Output is correct |
31 |
Execution timed out |
5087 ms |
5056 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5097 ms |
6264 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5090 ms |
6388 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1536 KB |
Output is correct |
4 |
Correct |
2 ms |
1536 KB |
Output is correct |
5 |
Correct |
16 ms |
1536 KB |
Output is correct |
6 |
Correct |
17 ms |
1536 KB |
Output is correct |
7 |
Correct |
16 ms |
1536 KB |
Output is correct |
8 |
Correct |
17 ms |
1536 KB |
Output is correct |
9 |
Correct |
17 ms |
1536 KB |
Output is correct |
10 |
Correct |
16 ms |
1536 KB |
Output is correct |
11 |
Correct |
16 ms |
1536 KB |
Output is correct |
12 |
Correct |
17 ms |
1536 KB |
Output is correct |
13 |
Correct |
16 ms |
1536 KB |
Output is correct |
14 |
Correct |
16 ms |
1536 KB |
Output is correct |
15 |
Correct |
16 ms |
1536 KB |
Output is correct |
16 |
Correct |
17 ms |
1536 KB |
Output is correct |
17 |
Correct |
17 ms |
1536 KB |
Output is correct |
18 |
Correct |
18 ms |
1536 KB |
Output is correct |
19 |
Correct |
17 ms |
1536 KB |
Output is correct |
20 |
Correct |
16 ms |
1536 KB |
Output is correct |
21 |
Correct |
27 ms |
1536 KB |
Output is correct |
22 |
Correct |
20 ms |
1536 KB |
Output is correct |
23 |
Correct |
17 ms |
1536 KB |
Output is correct |
24 |
Correct |
17 ms |
1536 KB |
Output is correct |
25 |
Correct |
16 ms |
1536 KB |
Output is correct |
26 |
Correct |
16 ms |
1536 KB |
Output is correct |
27 |
Correct |
17 ms |
1536 KB |
Output is correct |
28 |
Correct |
27 ms |
1536 KB |
Output is correct |
29 |
Correct |
16 ms |
1536 KB |
Output is correct |
30 |
Correct |
16 ms |
1536 KB |
Output is correct |
31 |
Execution timed out |
5087 ms |
5056 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1536 KB |
Output is correct |
4 |
Correct |
2 ms |
1536 KB |
Output is correct |
5 |
Correct |
16 ms |
1536 KB |
Output is correct |
6 |
Correct |
17 ms |
1536 KB |
Output is correct |
7 |
Correct |
16 ms |
1536 KB |
Output is correct |
8 |
Correct |
17 ms |
1536 KB |
Output is correct |
9 |
Correct |
17 ms |
1536 KB |
Output is correct |
10 |
Correct |
16 ms |
1536 KB |
Output is correct |
11 |
Correct |
16 ms |
1536 KB |
Output is correct |
12 |
Correct |
17 ms |
1536 KB |
Output is correct |
13 |
Correct |
16 ms |
1536 KB |
Output is correct |
14 |
Correct |
16 ms |
1536 KB |
Output is correct |
15 |
Correct |
16 ms |
1536 KB |
Output is correct |
16 |
Correct |
17 ms |
1536 KB |
Output is correct |
17 |
Correct |
17 ms |
1536 KB |
Output is correct |
18 |
Correct |
18 ms |
1536 KB |
Output is correct |
19 |
Correct |
17 ms |
1536 KB |
Output is correct |
20 |
Correct |
16 ms |
1536 KB |
Output is correct |
21 |
Correct |
27 ms |
1536 KB |
Output is correct |
22 |
Correct |
20 ms |
1536 KB |
Output is correct |
23 |
Correct |
17 ms |
1536 KB |
Output is correct |
24 |
Correct |
17 ms |
1536 KB |
Output is correct |
25 |
Correct |
16 ms |
1536 KB |
Output is correct |
26 |
Correct |
16 ms |
1536 KB |
Output is correct |
27 |
Correct |
17 ms |
1536 KB |
Output is correct |
28 |
Correct |
27 ms |
1536 KB |
Output is correct |
29 |
Correct |
16 ms |
1536 KB |
Output is correct |
30 |
Correct |
16 ms |
1536 KB |
Output is correct |
31 |
Execution timed out |
5087 ms |
5056 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |