# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
905457 | 2024-01-13T02:48:25 Z | nguyentunglam | 새 집 (APIO18_new_home) | C++17 | 5000 ms | 41872 KB |
#include<bits/stdc++.h> #define all(v) v.begin(), v.end() #define endl "\n" using namespace std; const int N = 3e5 + 10; int n, k, q; int x[N], t[N], a[N], b[N], cost[N]; set<int> s[N]; int32_t main() { #define task "" cin.tie(0) -> sync_with_stdio(0); if (fopen("task.inp", "r")) { freopen("task.inp", "r", stdin); freopen("task.out", "w", stdout); } if (fopen(task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } cin >> n >> k >> q; for(int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i]; for(int i = 1; i <= n; i++) s[t[i]].insert(i); while (q--) { int l, y; cin >> l >> y; for(int i = 1; i <= k; i++) cost[i] = 1e9; for(int i = 1; i <= n; i++) if (a[i] <= y && y <= b[i]) { cost[t[i]] = min(cost[t[i]], abs(l - x[i])); } int ans = 0; for(int i = 1; i <= k; i++) ans = max(ans, cost[i]); if (ans == 1e9) ans = -1; cout << ans << endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 19032 KB | Output is correct |
2 | Correct | 5 ms | 19036 KB | Output is correct |
3 | Correct | 6 ms | 19108 KB | Output is correct |
4 | Correct | 7 ms | 19096 KB | Output is correct |
5 | Correct | 6 ms | 19100 KB | Output is correct |
6 | Correct | 7 ms | 19104 KB | Output is correct |
7 | Correct | 8 ms | 19104 KB | Output is correct |
8 | Correct | 7 ms | 19036 KB | Output is correct |
9 | Correct | 7 ms | 19036 KB | Output is correct |
10 | Correct | 7 ms | 19036 KB | Output is correct |
11 | Correct | 7 ms | 19036 KB | Output is correct |
12 | Correct | 6 ms | 19036 KB | Output is correct |
13 | Correct | 6 ms | 19032 KB | Output is correct |
14 | Correct | 6 ms | 19036 KB | Output is correct |
15 | Correct | 6 ms | 19116 KB | Output is correct |
16 | Correct | 6 ms | 19032 KB | Output is correct |
17 | Correct | 7 ms | 19036 KB | Output is correct |
18 | Correct | 7 ms | 19032 KB | Output is correct |
19 | Correct | 7 ms | 19156 KB | Output is correct |
20 | Correct | 6 ms | 19152 KB | Output is correct |
21 | Correct | 8 ms | 19032 KB | Output is correct |
22 | Correct | 7 ms | 19032 KB | Output is correct |
23 | Correct | 6 ms | 19032 KB | Output is correct |
24 | Correct | 7 ms | 19036 KB | Output is correct |
25 | Correct | 6 ms | 19036 KB | Output is correct |
26 | Correct | 7 ms | 19036 KB | Output is correct |
27 | Correct | 6 ms | 19032 KB | Output is correct |
28 | Correct | 6 ms | 19032 KB | Output is correct |
29 | Correct | 6 ms | 19308 KB | Output is correct |
30 | Correct | 6 ms | 19036 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 19032 KB | Output is correct |
2 | Correct | 5 ms | 19036 KB | Output is correct |
3 | Correct | 6 ms | 19108 KB | Output is correct |
4 | Correct | 7 ms | 19096 KB | Output is correct |
5 | Correct | 6 ms | 19100 KB | Output is correct |
6 | Correct | 7 ms | 19104 KB | Output is correct |
7 | Correct | 8 ms | 19104 KB | Output is correct |
8 | Correct | 7 ms | 19036 KB | Output is correct |
9 | Correct | 7 ms | 19036 KB | Output is correct |
10 | Correct | 7 ms | 19036 KB | Output is correct |
11 | Correct | 7 ms | 19036 KB | Output is correct |
12 | Correct | 6 ms | 19036 KB | Output is correct |
13 | Correct | 6 ms | 19032 KB | Output is correct |
14 | Correct | 6 ms | 19036 KB | Output is correct |
15 | Correct | 6 ms | 19116 KB | Output is correct |
16 | Correct | 6 ms | 19032 KB | Output is correct |
17 | Correct | 7 ms | 19036 KB | Output is correct |
18 | Correct | 7 ms | 19032 KB | Output is correct |
19 | Correct | 7 ms | 19156 KB | Output is correct |
20 | Correct | 6 ms | 19152 KB | Output is correct |
21 | Correct | 8 ms | 19032 KB | Output is correct |
22 | Correct | 7 ms | 19032 KB | Output is correct |
23 | Correct | 6 ms | 19032 KB | Output is correct |
24 | Correct | 7 ms | 19036 KB | Output is correct |
25 | Correct | 6 ms | 19036 KB | Output is correct |
26 | Correct | 7 ms | 19036 KB | Output is correct |
27 | Correct | 6 ms | 19032 KB | Output is correct |
28 | Correct | 6 ms | 19032 KB | Output is correct |
29 | Correct | 6 ms | 19308 KB | Output is correct |
30 | Correct | 6 ms | 19036 KB | Output is correct |
31 | Execution timed out | 5024 ms | 23952 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5047 ms | 41872 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5024 ms | 41032 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 19032 KB | Output is correct |
2 | Correct | 5 ms | 19036 KB | Output is correct |
3 | Correct | 6 ms | 19108 KB | Output is correct |
4 | Correct | 7 ms | 19096 KB | Output is correct |
5 | Correct | 6 ms | 19100 KB | Output is correct |
6 | Correct | 7 ms | 19104 KB | Output is correct |
7 | Correct | 8 ms | 19104 KB | Output is correct |
8 | Correct | 7 ms | 19036 KB | Output is correct |
9 | Correct | 7 ms | 19036 KB | Output is correct |
10 | Correct | 7 ms | 19036 KB | Output is correct |
11 | Correct | 7 ms | 19036 KB | Output is correct |
12 | Correct | 6 ms | 19036 KB | Output is correct |
13 | Correct | 6 ms | 19032 KB | Output is correct |
14 | Correct | 6 ms | 19036 KB | Output is correct |
15 | Correct | 6 ms | 19116 KB | Output is correct |
16 | Correct | 6 ms | 19032 KB | Output is correct |
17 | Correct | 7 ms | 19036 KB | Output is correct |
18 | Correct | 7 ms | 19032 KB | Output is correct |
19 | Correct | 7 ms | 19156 KB | Output is correct |
20 | Correct | 6 ms | 19152 KB | Output is correct |
21 | Correct | 8 ms | 19032 KB | Output is correct |
22 | Correct | 7 ms | 19032 KB | Output is correct |
23 | Correct | 6 ms | 19032 KB | Output is correct |
24 | Correct | 7 ms | 19036 KB | Output is correct |
25 | Correct | 6 ms | 19036 KB | Output is correct |
26 | Correct | 7 ms | 19036 KB | Output is correct |
27 | Correct | 6 ms | 19032 KB | Output is correct |
28 | Correct | 6 ms | 19032 KB | Output is correct |
29 | Correct | 6 ms | 19308 KB | Output is correct |
30 | Correct | 6 ms | 19036 KB | Output is correct |
31 | Execution timed out | 5024 ms | 23952 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 19032 KB | Output is correct |
2 | Correct | 5 ms | 19036 KB | Output is correct |
3 | Correct | 6 ms | 19108 KB | Output is correct |
4 | Correct | 7 ms | 19096 KB | Output is correct |
5 | Correct | 6 ms | 19100 KB | Output is correct |
6 | Correct | 7 ms | 19104 KB | Output is correct |
7 | Correct | 8 ms | 19104 KB | Output is correct |
8 | Correct | 7 ms | 19036 KB | Output is correct |
9 | Correct | 7 ms | 19036 KB | Output is correct |
10 | Correct | 7 ms | 19036 KB | Output is correct |
11 | Correct | 7 ms | 19036 KB | Output is correct |
12 | Correct | 6 ms | 19036 KB | Output is correct |
13 | Correct | 6 ms | 19032 KB | Output is correct |
14 | Correct | 6 ms | 19036 KB | Output is correct |
15 | Correct | 6 ms | 19116 KB | Output is correct |
16 | Correct | 6 ms | 19032 KB | Output is correct |
17 | Correct | 7 ms | 19036 KB | Output is correct |
18 | Correct | 7 ms | 19032 KB | Output is correct |
19 | Correct | 7 ms | 19156 KB | Output is correct |
20 | Correct | 6 ms | 19152 KB | Output is correct |
21 | Correct | 8 ms | 19032 KB | Output is correct |
22 | Correct | 7 ms | 19032 KB | Output is correct |
23 | Correct | 6 ms | 19032 KB | Output is correct |
24 | Correct | 7 ms | 19036 KB | Output is correct |
25 | Correct | 6 ms | 19036 KB | Output is correct |
26 | Correct | 7 ms | 19036 KB | Output is correct |
27 | Correct | 6 ms | 19032 KB | Output is correct |
28 | Correct | 6 ms | 19032 KB | Output is correct |
29 | Correct | 6 ms | 19308 KB | Output is correct |
30 | Correct | 6 ms | 19036 KB | Output is correct |
31 | Execution timed out | 5024 ms | 23952 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |