# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117750 | 2019-06-17T07:25:52 Z | 김세빈(#2878) | Tenis (COI19_tenis) | C++14 | 104 ms | 5384 KB |
#include <bits/stdc++.h> using namespace std; struct minseg{ int T[303030]; const int sz = 1 << 17; void update(int p, int v) { p += sz; T[p] = v; for(p>>=1; p; p>>=1){ T[p] = min(T[p << 1], T[p << 1 | 1]); } } int get_min(int l, int r) { int ret = 1e9; l += sz; r += sz; for(; l<r; ){ if(l & 1) ret = min(ret, T[l]); if(~r & 1) ret = min(ret, T[r]); l = l + 1 >> 1; r = r - 1 >> 1; } if(l == r){ ret = min(ret, T[l]); } return ret; } }; minseg T; int A[3][101010], B[3][101010]; int n; int main() { int q, i, j, t, x, y; scanf("%d%d", &n, &q); if(q > 10){ return 0; } for(i=0; i<=2; i++){ for(j=1; j<=n; j++){ scanf("%d", A[i] + j); B[i][A[i][j]] = j; } } for(i=1; i<=n; i++){ T.update(i, min(B[1][A[0][i]], B[2][A[0][i]])); } for(; q--; ){ scanf("%d", &t); if(t == 1){ scanf("%d", &x); for(i=B[0][x]; i>=1; i--){ if(T.get_min(i, n) >= i) break; } printf("%s\n", i == 1? "DA" : "NE"); } else{ scanf("%d%d%d", &t, &x, &y); t --; swap(A[t][B[t][x]], A[t][B[t][y]]); swap(B[t][x], B[t][y]); for(i=1; i<=n; i++){ T.update(i, min(B[1][A[0][i]], B[2][A[0][i]])); } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 17 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 17 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 104 ms | 5240 KB | Output is correct |
14 | Correct | 101 ms | 5384 KB | Output is correct |
15 | Correct | 87 ms | 5288 KB | Output is correct |
16 | Correct | 76 ms | 5248 KB | Output is correct |
17 | Correct | 51 ms | 5240 KB | Output is correct |
18 | Correct | 73 ms | 5248 KB | Output is correct |
19 | Correct | 68 ms | 5240 KB | Output is correct |
20 | Correct | 97 ms | 5240 KB | Output is correct |
21 | Correct | 57 ms | 5368 KB | Output is correct |
22 | Correct | 85 ms | 5240 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 17 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 104 ms | 5240 KB | Output is correct |
14 | Correct | 101 ms | 5384 KB | Output is correct |
15 | Correct | 87 ms | 5288 KB | Output is correct |
16 | Correct | 76 ms | 5248 KB | Output is correct |
17 | Correct | 51 ms | 5240 KB | Output is correct |
18 | Correct | 73 ms | 5248 KB | Output is correct |
19 | Correct | 68 ms | 5240 KB | Output is correct |
20 | Correct | 97 ms | 5240 KB | Output is correct |
21 | Correct | 57 ms | 5368 KB | Output is correct |
22 | Correct | 85 ms | 5240 KB | Output is correct |
23 | Incorrect | 2 ms | 256 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |