# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871133 | NeroZein | New Home (APIO18_new_home) | C++17 | 5081 ms | 19516 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |