# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
908597 | 2024-01-16T14:52:30 Z | lighton | Tenis (COI19_tenis) | C++17 | 500 ms | 9672 KB |
#include<bits/stdc++.h> #define forf(i,a,b) for(int i = a; i<=b; i++) #define all(v) v.begin(),v.end() typedef long long ll; using namespace std; int N,Q; int rnk[3][100001]; int pos[3][100001]; int cnt[100001]; set<int> possible; void findpossible(){ forf(i,1,N) cnt[i] = 0; int noncomplete = 0; possible.clear(); forf(i,1,N){ forf(j,0,2){ cnt[rnk[j][i]]++; if(cnt[rnk[j][i]] == 1){ noncomplete++; possible.insert(rnk[j][i]); } if(cnt[rnk[j][i]] == 3) noncomplete--; } if(noncomplete == 0) return; } } int main(){ scanf("%d %d" , &N,&Q); forf(i,0,2) forf(j,1,N){ scanf("%d" , &rnk[i][j]); pos[i][rnk[i][j]] = j; } findpossible(); while(Q--){ int cmd; scanf("%d" ,&cmd); if(cmd==1){ int t; scanf("%d" , &t); if(possible.find(t) == possible.end()) printf("NE\n"); else printf("DA\n"); } else{ int i,a,b;scanf("%d %d %d" , &i,&a,&b); i--; swap(rnk[i][pos[i][a]],rnk[i][pos[i][b]]); swap(pos[i][a],pos[i][b]); findpossible(); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 2 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 2 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 2 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2396 KB | Output is correct |
13 | Correct | 119 ms | 7508 KB | Output is correct |
14 | Correct | 154 ms | 8272 KB | Output is correct |
15 | Correct | 32 ms | 5300 KB | Output is correct |
16 | Correct | 52 ms | 5900 KB | Output is correct |
17 | Correct | 23 ms | 4652 KB | Output is correct |
18 | Correct | 23 ms | 4700 KB | Output is correct |
19 | Correct | 23 ms | 4952 KB | Output is correct |
20 | Correct | 47 ms | 5468 KB | Output is correct |
21 | Correct | 23 ms | 4756 KB | Output is correct |
22 | Correct | 26 ms | 4956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 8216 KB | Output is correct |
2 | Correct | 51 ms | 5968 KB | Output is correct |
3 | Correct | 46 ms | 5964 KB | Output is correct |
4 | Correct | 41 ms | 5904 KB | Output is correct |
5 | Correct | 44 ms | 5968 KB | Output is correct |
6 | Correct | 42 ms | 5760 KB | Output is correct |
7 | Correct | 43 ms | 5748 KB | Output is correct |
8 | Correct | 41 ms | 5796 KB | Output is correct |
9 | Correct | 47 ms | 6188 KB | Output is correct |
10 | Correct | 42 ms | 5712 KB | Output is correct |
11 | Correct | 58 ms | 6936 KB | Output is correct |
12 | Correct | 40 ms | 5716 KB | Output is correct |
13 | Correct | 46 ms | 5972 KB | Output is correct |
14 | Correct | 45 ms | 5968 KB | Output is correct |
15 | Correct | 45 ms | 5972 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 2 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2396 KB | Output is correct |
13 | Correct | 119 ms | 7508 KB | Output is correct |
14 | Correct | 154 ms | 8272 KB | Output is correct |
15 | Correct | 32 ms | 5300 KB | Output is correct |
16 | Correct | 52 ms | 5900 KB | Output is correct |
17 | Correct | 23 ms | 4652 KB | Output is correct |
18 | Correct | 23 ms | 4700 KB | Output is correct |
19 | Correct | 23 ms | 4952 KB | Output is correct |
20 | Correct | 47 ms | 5468 KB | Output is correct |
21 | Correct | 23 ms | 4756 KB | Output is correct |
22 | Correct | 26 ms | 4956 KB | Output is correct |
23 | Correct | 67 ms | 8216 KB | Output is correct |
24 | Correct | 51 ms | 5968 KB | Output is correct |
25 | Correct | 46 ms | 5964 KB | Output is correct |
26 | Correct | 41 ms | 5904 KB | Output is correct |
27 | Correct | 44 ms | 5968 KB | Output is correct |
28 | Correct | 42 ms | 5760 KB | Output is correct |
29 | Correct | 43 ms | 5748 KB | Output is correct |
30 | Correct | 41 ms | 5796 KB | Output is correct |
31 | Correct | 47 ms | 6188 KB | Output is correct |
32 | Correct | 42 ms | 5712 KB | Output is correct |
33 | Correct | 58 ms | 6936 KB | Output is correct |
34 | Correct | 40 ms | 5716 KB | Output is correct |
35 | Correct | 46 ms | 5972 KB | Output is correct |
36 | Correct | 45 ms | 5968 KB | Output is correct |
37 | Correct | 45 ms | 5972 KB | Output is correct |
38 | Execution timed out | 1066 ms | 9672 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |