# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871133 | 2023-11-10T02:03:12 Z | NeroZein | New Home (APIO18_new_home) | C++17 | 5000 ms | 19516 KB |
#include "bits/stdc++.h" #define int long long using namespace std; #ifdef Nero #include "Deb.h" #else #define deb(...) #endif signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, k, q; cin >> n >> k >> q; vector<bool> on(k); vector<long long> x(n), tp(n), l(n), r(n); for (int i = 0; i < n; ++i) { cin >> x[i] >> tp[i] >> l[i] >> r[i]; --tp[i]; } while (q--) { long long y, t; cin >> y >> t; long long ans = 0; vector<int> to_turn_off; for (int i = 0; i < n; ++i) { if (l[i] <= t && t <= r[i]) { ans = max(ans, abs(y - x[i])); if (!on[tp[i]]) { on[tp[i]] = true; to_turn_off.push_back(tp[i]); } } } if (to_turn_off.size() != k) { cout << -1 << '\n'; } else { cout << ans << '\n'; } for (int i : to_turn_off) { on[i] = false; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5081 ms | 19516 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5052 ms | 17748 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |