# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117625 | 2019-06-16T19:59:27 Z | Bruteforceman | Tenis (COI19_tenis) | C++11 | 500 ms | 4884 KB |
#include "bits/stdc++.h" using namespace std; int N, Q; int a[4][100010]; int p[4][100010]; int opt() { int mx1 = 0; int mx2 = 0; for(int i = 1; i <= N; i++) { mx1 = max(mx1, a[2][i]); mx2 = max(mx2, a[3][i]); if(mx1 == mx2 && mx1 == i) { return i; } } return N + 1; } void update(int q, int x, int y) { if(q == 1) { update(2, x, y); update(3, x, y); swap(p[1][a[1][x]], p[1][a[1][y]]); swap(a[1][x], a[1][y]); } else { int f = p[q][x]; int g = p[q][y]; swap(a[q][f], a[q][g]); swap(p[q][x], p[q][y]); } // cout << endl; // for(int i = 2; i <= 3; i++) { // for(int j = 1; j <= N; j++) { // cout << a[i][j] << ' '; // } // cout << endl; // } } int main(int argc, char const *argv[]) { scanf("%d %d", &N, &Q); for(int i = 1; i <= 3; i++) { for(int j = 1; j <= N; j++) { scanf("%d", &a[i][j]); p[i][a[i][j]] = j; } } for(int i = 2; i <= 3; i++) { for(int j = 1; j <= N; j++) { a[i][j] = p[1][a[i][j]]; p[i][a[i][j]] = j; // cout << a[i][j] << ' '; } // cout << endl; } int first = opt(); for(int i = 1; i <= Q; i++) { int c; scanf("%d", &c); if(c == 1) { int x; scanf("%d", &x); if(p[1][x] <= first) printf("DA\n"); else printf("NE\n"); } else { int f, x, y; scanf("%d %d %d", &f, &x, &y); update(f, p[1][x], p[1][y]); first = opt(); } } 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 | 2 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 | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 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 | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 42 ms | 2680 KB | Output is correct |
14 | Correct | 44 ms | 2680 KB | Output is correct |
15 | Correct | 42 ms | 2680 KB | Output is correct |
16 | Correct | 42 ms | 2680 KB | Output is correct |
17 | Correct | 43 ms | 2680 KB | Output is correct |
18 | Correct | 41 ms | 2680 KB | Output is correct |
19 | Correct | 44 ms | 2680 KB | Output is correct |
20 | Correct | 42 ms | 2680 KB | Output is correct |
21 | Correct | 42 ms | 2680 KB | Output is correct |
22 | Correct | 41 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 2940 KB | Output is correct |
2 | Correct | 66 ms | 3964 KB | Output is correct |
3 | Correct | 66 ms | 3960 KB | Output is correct |
4 | Correct | 66 ms | 3960 KB | Output is correct |
5 | Correct | 66 ms | 3960 KB | Output is correct |
6 | Correct | 66 ms | 3960 KB | Output is correct |
7 | Correct | 66 ms | 4216 KB | Output is correct |
8 | Correct | 65 ms | 3960 KB | Output is correct |
9 | Correct | 67 ms | 4088 KB | Output is correct |
10 | Correct | 63 ms | 3960 KB | Output is correct |
11 | Correct | 68 ms | 3960 KB | Output is correct |
12 | Correct | 64 ms | 3960 KB | Output is correct |
13 | Correct | 69 ms | 3960 KB | Output is correct |
14 | Correct | 66 ms | 4088 KB | Output is correct |
15 | Correct | 66 ms | 3960 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 | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 42 ms | 2680 KB | Output is correct |
14 | Correct | 44 ms | 2680 KB | Output is correct |
15 | Correct | 42 ms | 2680 KB | Output is correct |
16 | Correct | 42 ms | 2680 KB | Output is correct |
17 | Correct | 43 ms | 2680 KB | Output is correct |
18 | Correct | 41 ms | 2680 KB | Output is correct |
19 | Correct | 44 ms | 2680 KB | Output is correct |
20 | Correct | 42 ms | 2680 KB | Output is correct |
21 | Correct | 42 ms | 2680 KB | Output is correct |
22 | Correct | 41 ms | 2680 KB | Output is correct |
23 | Correct | 68 ms | 2940 KB | Output is correct |
24 | Correct | 66 ms | 3964 KB | Output is correct |
25 | Correct | 66 ms | 3960 KB | Output is correct |
26 | Correct | 66 ms | 3960 KB | Output is correct |
27 | Correct | 66 ms | 3960 KB | Output is correct |
28 | Correct | 66 ms | 3960 KB | Output is correct |
29 | Correct | 66 ms | 4216 KB | Output is correct |
30 | Correct | 65 ms | 3960 KB | Output is correct |
31 | Correct | 67 ms | 4088 KB | Output is correct |
32 | Correct | 63 ms | 3960 KB | Output is correct |
33 | Correct | 68 ms | 3960 KB | Output is correct |
34 | Correct | 64 ms | 3960 KB | Output is correct |
35 | Correct | 69 ms | 3960 KB | Output is correct |
36 | Correct | 66 ms | 4088 KB | Output is correct |
37 | Correct | 66 ms | 3960 KB | Output is correct |
38 | Execution timed out | 1070 ms | 4884 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |