# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
185647 | 2020-01-12T03:04:07 Z | anonymous | Tenis (COI19_tenis) | C++14 | 500 ms | 9148 KB |
#include<iostream> #include<queue> #define MAXN 100005 using namespace std; int N,Q, L[MAXN][3], Pos[MAXN][3], Worst[3][3][MAXN]; //(i,j,k) lowest ranked player on court type i in first k of court type j bool done[MAXN]; int f1=1, f2=1, f3=1; //frontiers int op, qa, qb, qc; queue <int> q; void slv() { f1=1, f2=1, f3=1; for (int i=0; i<3; i++) { for (int j=1; j<=N; j++) { Pos[L[j][i]][i]=j; } } for (int i=0; i<3; i++) { for (int j=1; j<=N; j++) { for (int k=0; k<3; k++) { Worst[i][k][j]=0; } //i is current court, k is court being maximised, j is prefix } } for (int i=0; i<3; i++) { for (int j=1; j<=N; j++) { for (int k=0; k<3; k++) { Worst[i][k][j]=max(max(Worst[i][k][j], Worst[i][k][j-1]), Pos[L[j][i]][k]); } //i is current court, k is court being maximised, j is prefix } } while (true) { int pf1=f1, pf2=f2, pf3=f3; int A[3]={f1,f2,f3}; for (int i=0; i<3; i++) { f1=max(f1, Worst[0][i][A[i]]); f2=max(f2, Worst[1][i][A[i]]); f3=max(f3, Worst[2][i][A[i]]); } //printf("%d %d %d\n",f1,f2,f3); if (f1 == pf1 && f2 == pf2 && f3 == pf3) {break;} } } bool ask(int x) { return(Pos[x][0] <= f1 || Pos[x][1] <= f2 || Pos[x][2] <= f3); } int main() { //freopen("tenin.txt","r",stdin); scanf("%d %d",&N,&Q); for (int i=0; i<3; i++) { for (int j=1; j<=N; j++) { scanf("%d", &L[j][i]); } } slv(); for (int i=0; i<Q; i++) { scanf("%d", &op); if (op == 2) { scanf("%d %d %d", &qa, &qb, &qc); swap(L[Pos[qb][qa-1]][qa-1], L[Pos[qc][qa-1]][qa-1]); slv(); } else { scanf("%d", &qa); printf("%s\n", ask(qa) ? "DA" : "NE"); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 98 ms | 7928 KB | Output is correct |
14 | Correct | 105 ms | 7984 KB | Output is correct |
15 | Correct | 103 ms | 7928 KB | Output is correct |
16 | Correct | 88 ms | 7928 KB | Output is correct |
17 | Correct | 63 ms | 7980 KB | Output is correct |
18 | Correct | 92 ms | 8056 KB | Output is correct |
19 | Correct | 81 ms | 8056 KB | Output is correct |
20 | Correct | 125 ms | 7928 KB | Output is correct |
21 | Correct | 72 ms | 8040 KB | Output is correct |
22 | Correct | 101 ms | 8056 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 96 ms | 9052 KB | Output is correct |
2 | Correct | 96 ms | 9080 KB | Output is correct |
3 | Correct | 95 ms | 9148 KB | Output is correct |
4 | Correct | 95 ms | 9028 KB | Output is correct |
5 | Correct | 95 ms | 8992 KB | Output is correct |
6 | Correct | 98 ms | 9104 KB | Output is correct |
7 | Correct | 93 ms | 9028 KB | Output is correct |
8 | Correct | 95 ms | 9060 KB | Output is correct |
9 | Correct | 99 ms | 9028 KB | Output is correct |
10 | Correct | 96 ms | 8952 KB | Output is correct |
11 | Correct | 93 ms | 9080 KB | Output is correct |
12 | Correct | 95 ms | 8992 KB | Output is correct |
13 | Correct | 107 ms | 9072 KB | Output is correct |
14 | Correct | 95 ms | 9044 KB | Output is correct |
15 | Correct | 93 ms | 8936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 98 ms | 7928 KB | Output is correct |
14 | Correct | 105 ms | 7984 KB | Output is correct |
15 | Correct | 103 ms | 7928 KB | Output is correct |
16 | Correct | 88 ms | 7928 KB | Output is correct |
17 | Correct | 63 ms | 7980 KB | Output is correct |
18 | Correct | 92 ms | 8056 KB | Output is correct |
19 | Correct | 81 ms | 8056 KB | Output is correct |
20 | Correct | 125 ms | 7928 KB | Output is correct |
21 | Correct | 72 ms | 8040 KB | Output is correct |
22 | Correct | 101 ms | 8056 KB | Output is correct |
23 | Correct | 96 ms | 9052 KB | Output is correct |
24 | Correct | 96 ms | 9080 KB | Output is correct |
25 | Correct | 95 ms | 9148 KB | Output is correct |
26 | Correct | 95 ms | 9028 KB | Output is correct |
27 | Correct | 95 ms | 8992 KB | Output is correct |
28 | Correct | 98 ms | 9104 KB | Output is correct |
29 | Correct | 93 ms | 9028 KB | Output is correct |
30 | Correct | 95 ms | 9060 KB | Output is correct |
31 | Correct | 99 ms | 9028 KB | Output is correct |
32 | Correct | 96 ms | 8952 KB | Output is correct |
33 | Correct | 93 ms | 9080 KB | Output is correct |
34 | Correct | 95 ms | 8992 KB | Output is correct |
35 | Correct | 107 ms | 9072 KB | Output is correct |
36 | Correct | 95 ms | 9044 KB | Output is correct |
37 | Correct | 93 ms | 8936 KB | Output is correct |
38 | Execution timed out | 1076 ms | 8120 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |