# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
658986 | 600Mihnea | 새 집 (APIO18_new_home) | C++17 | 5085 ms | 17304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
bool home = 0;
#include <bits/stdc++.h>
using namespace std;
struct Store {
int x;
int type;
int first_time;
int last_time;
};
struct Query {
int x;
int t;
};
const int N = (int) 3e5 + 7;
int n;
int k;
int q;
vector<int> whereType[N];
Store stores[N];
Query queries[N];
int main() {
if (home) {
freopen ("input.txt", "r", stdin);
} else {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
{
/// Read
cin >> n >> k >> q;
for (int i = 1; i <= n; i++) {
cin >> stores[i].x >> stores[i].type >> stores[i].first_time >> stores[i].last_time;
whereType[stores[i].type].push_back(i);
}
for (int i = 1; i <= q; i++) {
cin >> queries[i].x >> queries[i].t;
}
}
{
/// Normalize time
}
{
/// Normalize positions
}
{
/// Brute
for (int iq = 1; iq <= q; iq++) {
int maxDist = 0;
for (int t = 1; t <= k; t++) {
int minDist = (int) 1e9 + 7;
for (auto &i : whereType[t]) {
if (stores[i].first_time <= queries[iq].t && queries[iq].t <= stores[i].last_time) {
minDist = min(minDist, abs(stores[i].x - queries[iq].x));
}
}
maxDist = max(maxDist, minDist);
}
if (maxDist == (int) 1e9 + 7) {
maxDist = -1;
}
cout << maxDist << "\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... |