# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
658765 | 600Mihnea | 새 집 (APIO18_new_home) | C++17 | 5025 ms | 23292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
bool home = 0;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = (int) 3e5 + 7;
const int INF = (int) 1e9 + 7;
int n;
int k;
int q;
struct T {
int x;
int t;
int a;
int b;
};
T v[N];
vector<int> gs[N];
int main() {
if (home == 0) {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
} else {
freopen ("input.txt", "r", stdin);
}
cin >> n >> k >> q;
for (int i = 1; i <= n; i++) {
cin >> v[i].x >> v[i].t >> v[i].a >> v[i].b;
gs[v[i].t].push_back(i);
}
for (int iq = 1; iq <= q; iq++) {
int x, t;
cin >> x >> t;
int sol = -INF;
for (int tp = 1; tp <= k; tp++) {
int nr = INF;
for (auto &i : gs[tp]) {
if (v[i].a <= t && t <= v[i].b) {
nr = min(nr, abs(x - v[i].x));
}
}
sol = max(sol, nr);
}
if (sol == INF) {
sol = -1;
}
cout << sol << "\n";
}
return 0;
}
컴파일 시 표준 에러 (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... |