# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144264 | 2019-08-16T12:09:18 Z | SamAnd | Tenis (COI19_tenis) | C++17 | 73 ms | 504 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1003; struct ban { int x, y, z; }; int n, q; ban a[N], b[N]; bool c[N]; void bil() { memset(c, false, sizeof c); set<int> sx, sy, sz; set<int> s; for (int i = n; i > 1; --i) { sx.insert(a[i].x); sy.insert(a[i].y); sz.insert(a[i].z); if (sx == sy && sy == sz) { s = sx; } } for (set<int>::iterator it = s.begin(); it != s.end(); ++it) c[*it] = true; } int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i].x); b[a[i].x].x = i; } for (int i = 1; i <= n; ++i) { scanf("%d", &a[i].y); b[a[i].y].y = i; } for (int i = 1; i <= n; ++i) { scanf("%d", &a[i].z); b[a[i].z].z = i; } bil(); while (q--) { int ty; scanf("%d", &ty); if (ty == 1) { int x; scanf("%d", &x); if (c[x] == false) printf("DA\n"); else printf("NE\n"); } else { int p, x, y; scanf("%d%d%d", &p, &x, &y); if (p == 1) { swap(a[b[x].x].x, a[b[y].x].x); swap(b[x].x, b[y].x); } else if (p == 2) { swap(a[b[x].y].y, a[b[y].y].y); swap(b[x].y, b[y].y); } else { swap(a[b[x].z].z, a[b[y].z].z); swap(b[x].z, b[y].z); } bil(); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 24 ms | 504 KB | Output is correct |
8 | Correct | 5 ms | 504 KB | Output is correct |
9 | Correct | 38 ms | 504 KB | Output is correct |
10 | Correct | 73 ms | 504 KB | Output is correct |
11 | Correct | 19 ms | 504 KB | Output is correct |
12 | Correct | 12 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 24 ms | 504 KB | Output is correct |
8 | Correct | 5 ms | 504 KB | Output is correct |
9 | Correct | 38 ms | 504 KB | Output is correct |
10 | Correct | 73 ms | 504 KB | Output is correct |
11 | Correct | 19 ms | 504 KB | Output is correct |
12 | Correct | 12 ms | 504 KB | Output is correct |
13 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 24 ms | 504 KB | Output is correct |
8 | Correct | 5 ms | 504 KB | Output is correct |
9 | Correct | 38 ms | 504 KB | Output is correct |
10 | Correct | 73 ms | 504 KB | Output is correct |
11 | Correct | 19 ms | 504 KB | Output is correct |
12 | Correct | 12 ms | 504 KB | Output is correct |
13 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Halted | 0 ms | 0 KB | - |