# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
658986 | 2022-11-15T17:46:03 Z | 600Mihnea | 새 집 (APIO18_new_home) | C++17 | 5000 ms | 17304 KB |
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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 7252 KB | Output is correct |
2 | Correct | 4 ms | 7252 KB | Output is correct |
3 | Correct | 4 ms | 7372 KB | Output is correct |
4 | Correct | 4 ms | 7252 KB | Output is correct |
5 | Correct | 5 ms | 7376 KB | Output is correct |
6 | Correct | 5 ms | 7392 KB | Output is correct |
7 | Correct | 5 ms | 7380 KB | Output is correct |
8 | Correct | 5 ms | 7388 KB | Output is correct |
9 | Correct | 6 ms | 7384 KB | Output is correct |
10 | Correct | 5 ms | 7380 KB | Output is correct |
11 | Correct | 5 ms | 7380 KB | Output is correct |
12 | Correct | 5 ms | 7384 KB | Output is correct |
13 | Correct | 4 ms | 7380 KB | Output is correct |
14 | Correct | 4 ms | 7380 KB | Output is correct |
15 | Correct | 5 ms | 7380 KB | Output is correct |
16 | Correct | 4 ms | 7380 KB | Output is correct |
17 | Correct | 5 ms | 7380 KB | Output is correct |
18 | Correct | 5 ms | 7384 KB | Output is correct |
19 | Correct | 5 ms | 7380 KB | Output is correct |
20 | Correct | 4 ms | 7380 KB | Output is correct |
21 | Correct | 5 ms | 7380 KB | Output is correct |
22 | Correct | 5 ms | 7380 KB | Output is correct |
23 | Correct | 5 ms | 7380 KB | Output is correct |
24 | Correct | 5 ms | 7384 KB | Output is correct |
25 | Correct | 5 ms | 7380 KB | Output is correct |
26 | Correct | 5 ms | 7384 KB | Output is correct |
27 | Correct | 5 ms | 7380 KB | Output is correct |
28 | Correct | 4 ms | 7380 KB | Output is correct |
29 | Correct | 4 ms | 7380 KB | Output is correct |
30 | Correct | 5 ms | 7384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 7252 KB | Output is correct |
2 | Correct | 4 ms | 7252 KB | Output is correct |
3 | Correct | 4 ms | 7372 KB | Output is correct |
4 | Correct | 4 ms | 7252 KB | Output is correct |
5 | Correct | 5 ms | 7376 KB | Output is correct |
6 | Correct | 5 ms | 7392 KB | Output is correct |
7 | Correct | 5 ms | 7380 KB | Output is correct |
8 | Correct | 5 ms | 7388 KB | Output is correct |
9 | Correct | 6 ms | 7384 KB | Output is correct |
10 | Correct | 5 ms | 7380 KB | Output is correct |
11 | Correct | 5 ms | 7380 KB | Output is correct |
12 | Correct | 5 ms | 7384 KB | Output is correct |
13 | Correct | 4 ms | 7380 KB | Output is correct |
14 | Correct | 4 ms | 7380 KB | Output is correct |
15 | Correct | 5 ms | 7380 KB | Output is correct |
16 | Correct | 4 ms | 7380 KB | Output is correct |
17 | Correct | 5 ms | 7380 KB | Output is correct |
18 | Correct | 5 ms | 7384 KB | Output is correct |
19 | Correct | 5 ms | 7380 KB | Output is correct |
20 | Correct | 4 ms | 7380 KB | Output is correct |
21 | Correct | 5 ms | 7380 KB | Output is correct |
22 | Correct | 5 ms | 7380 KB | Output is correct |
23 | Correct | 5 ms | 7380 KB | Output is correct |
24 | Correct | 5 ms | 7384 KB | Output is correct |
25 | Correct | 5 ms | 7380 KB | Output is correct |
26 | Correct | 5 ms | 7384 KB | Output is correct |
27 | Correct | 5 ms | 7380 KB | Output is correct |
28 | Correct | 4 ms | 7380 KB | Output is correct |
29 | Correct | 4 ms | 7380 KB | Output is correct |
30 | Correct | 5 ms | 7384 KB | Output is correct |
31 | Execution timed out | 5076 ms | 12300 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5085 ms | 17304 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5064 ms | 16372 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 7252 KB | Output is correct |
2 | Correct | 4 ms | 7252 KB | Output is correct |
3 | Correct | 4 ms | 7372 KB | Output is correct |
4 | Correct | 4 ms | 7252 KB | Output is correct |
5 | Correct | 5 ms | 7376 KB | Output is correct |
6 | Correct | 5 ms | 7392 KB | Output is correct |
7 | Correct | 5 ms | 7380 KB | Output is correct |
8 | Correct | 5 ms | 7388 KB | Output is correct |
9 | Correct | 6 ms | 7384 KB | Output is correct |
10 | Correct | 5 ms | 7380 KB | Output is correct |
11 | Correct | 5 ms | 7380 KB | Output is correct |
12 | Correct | 5 ms | 7384 KB | Output is correct |
13 | Correct | 4 ms | 7380 KB | Output is correct |
14 | Correct | 4 ms | 7380 KB | Output is correct |
15 | Correct | 5 ms | 7380 KB | Output is correct |
16 | Correct | 4 ms | 7380 KB | Output is correct |
17 | Correct | 5 ms | 7380 KB | Output is correct |
18 | Correct | 5 ms | 7384 KB | Output is correct |
19 | Correct | 5 ms | 7380 KB | Output is correct |
20 | Correct | 4 ms | 7380 KB | Output is correct |
21 | Correct | 5 ms | 7380 KB | Output is correct |
22 | Correct | 5 ms | 7380 KB | Output is correct |
23 | Correct | 5 ms | 7380 KB | Output is correct |
24 | Correct | 5 ms | 7384 KB | Output is correct |
25 | Correct | 5 ms | 7380 KB | Output is correct |
26 | Correct | 5 ms | 7384 KB | Output is correct |
27 | Correct | 5 ms | 7380 KB | Output is correct |
28 | Correct | 4 ms | 7380 KB | Output is correct |
29 | Correct | 4 ms | 7380 KB | Output is correct |
30 | Correct | 5 ms | 7384 KB | Output is correct |
31 | Execution timed out | 5076 ms | 12300 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 7252 KB | Output is correct |
2 | Correct | 4 ms | 7252 KB | Output is correct |
3 | Correct | 4 ms | 7372 KB | Output is correct |
4 | Correct | 4 ms | 7252 KB | Output is correct |
5 | Correct | 5 ms | 7376 KB | Output is correct |
6 | Correct | 5 ms | 7392 KB | Output is correct |
7 | Correct | 5 ms | 7380 KB | Output is correct |
8 | Correct | 5 ms | 7388 KB | Output is correct |
9 | Correct | 6 ms | 7384 KB | Output is correct |
10 | Correct | 5 ms | 7380 KB | Output is correct |
11 | Correct | 5 ms | 7380 KB | Output is correct |
12 | Correct | 5 ms | 7384 KB | Output is correct |
13 | Correct | 4 ms | 7380 KB | Output is correct |
14 | Correct | 4 ms | 7380 KB | Output is correct |
15 | Correct | 5 ms | 7380 KB | Output is correct |
16 | Correct | 4 ms | 7380 KB | Output is correct |
17 | Correct | 5 ms | 7380 KB | Output is correct |
18 | Correct | 5 ms | 7384 KB | Output is correct |
19 | Correct | 5 ms | 7380 KB | Output is correct |
20 | Correct | 4 ms | 7380 KB | Output is correct |
21 | Correct | 5 ms | 7380 KB | Output is correct |
22 | Correct | 5 ms | 7380 KB | Output is correct |
23 | Correct | 5 ms | 7380 KB | Output is correct |
24 | Correct | 5 ms | 7384 KB | Output is correct |
25 | Correct | 5 ms | 7380 KB | Output is correct |
26 | Correct | 5 ms | 7384 KB | Output is correct |
27 | Correct | 5 ms | 7380 KB | Output is correct |
28 | Correct | 4 ms | 7380 KB | Output is correct |
29 | Correct | 4 ms | 7380 KB | Output is correct |
30 | Correct | 5 ms | 7384 KB | Output is correct |
31 | Execution timed out | 5076 ms | 12300 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |