#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
struct store {
int x, t, a, b;
store(int x, int t, int a, int b) : x(x), t(t), a(a), b(b) {}
};
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, k, q;
cin >> n >> k >> q;
vector <store> kek;
for (int i = 0; i < n; ++i) {
int x, t, a, b;
cin >> x >> t >> a >> b;
--t;
kek.emplace_back(x, t, a, b);
}
while (q--) {
int l, y;
cin >> l >> y;
vector <int> mx(k, (int)-1e9);
for (auto s : kek) {
if (s.a <= y && y <= s.b) {
mx[s.t] = max(mx[s.t], abs(l - s.x));
}
}
int ans = -1e9;
bool bad = false;
for (int i = 0; i < k; ++i) {
if (mx[i] < (int)-5e8) {
cout << "-1\n";
bad = true;
break;
}
ans = max(ans, mx[i]);
}
if (!bad) {
cout << ans << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
632 KB |
Output is correct |
4 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
632 KB |
Output is correct |
4 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5086 ms |
16216 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5088 ms |
24260 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
632 KB |
Output is correct |
4 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
632 KB |
Output is correct |
4 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |