이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k, q;
cin >> n >> k >> q;
vector<int> x(n), type(n), l(n), r(n);
for (int i = 0; i < n; i++) {
cin >> x[i] >> type[i] >> l[i] >> r[i];
type[i]--;
}
vector<int> best(k);
for (int i = 0; i < q; i++) {
int pos, tt;
cin >> pos >> tt;
fill(all(best), 1e9);
for (int j = 0; j < n; j++) {
if (tt >= l[j] && tt <= r[j]) {
best[type[j]] = min(best[type[j]], abs(pos - x[j]));
}
}
int rez = 0;
for (int j = 0; j < k; j++) {
rez = max(rez, best[j]);
}
if (rez == 1e9) {
cout << -1 << '\n';
}
else {
cout << rez << '\n';
}
}
}
# | 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... |