답안 #751600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751600 2023-05-31T22:36:38 Z Username4132 Tenis (COI19_tenis) C++14
51 / 100
500 ms 9112 KB
#include<iostream>
#include<set>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)

const int MAXN=100010;
int n, q, arr[3][MAXN], inv[3][MAXN];
set<int> winners;

void calc(){
    winners.clear();
    forn(i, n){
        forn(j, 3) winners.insert(arr[j][i]);
        if((int)winners.size()==i+1) break;
    }
}

int main(){
    scanf("%d %d", &n, &q);
    forn(i, 3) forn(j, n) scanf("%d", &arr[i][j]), --arr[i][j], inv[i][arr[i][j]]=j;
    calc();
    forn(i, q){
        int type; scanf("%d", &type);
        if(type==1){
            int x; scanf("%d", &x); --x;
            printf("%s\n", winners.find(x)==winners.end()? "NE\n" : "DA\n");
        }
        else{
            int p, a, b; scanf("%d %d %d", &p, &a, &b); --p, --a, --b;
            int posA=inv[p][a], posB=inv[p][b];
            swap(arr[p][posA], arr[p][posB]);
            swap(inv[p][a], inv[p][b]);
            calc();
        }
    }
}

Compilation message

tenis.cpp: In function 'int main()':
tenis.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
tenis.cpp:20:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     forn(i, 3) forn(j, n) scanf("%d", &arr[i][j]), --arr[i][j], inv[i][arr[i][j]]=j;
      |                           ~~~~~^~~~~~~~~~~~~~~~~~
tenis.cpp:23:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         int type; scanf("%d", &type);
      |                   ~~~~~^~~~~~~~~~~~~
tenis.cpp:25:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |             int x; scanf("%d", &x); --x;
      |                    ~~~~~^~~~~~~~~~
tenis.cpp:29:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             int p, a, b; scanf("%d %d %d", &p, &a, &b); --p, --a, --b;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 200 ms 7176 KB Output is correct
14 Correct 268 ms 8072 KB Output is correct
15 Correct 62 ms 4756 KB Output is correct
16 Correct 58 ms 5264 KB Output is correct
17 Correct 30 ms 4360 KB Output is correct
18 Correct 35 ms 4348 KB Output is correct
19 Correct 30 ms 4260 KB Output is correct
20 Correct 70 ms 4924 KB Output is correct
21 Correct 31 ms 4284 KB Output is correct
22 Correct 40 ms 4468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 7728 KB Output is correct
2 Correct 69 ms 5708 KB Output is correct
3 Correct 73 ms 5596 KB Output is correct
4 Correct 64 ms 5504 KB Output is correct
5 Correct 57 ms 5464 KB Output is correct
6 Correct 55 ms 5488 KB Output is correct
7 Correct 58 ms 5488 KB Output is correct
8 Correct 63 ms 5552 KB Output is correct
9 Correct 74 ms 5752 KB Output is correct
10 Correct 55 ms 5480 KB Output is correct
11 Correct 85 ms 6504 KB Output is correct
12 Correct 62 ms 5436 KB Output is correct
13 Correct 70 ms 5436 KB Output is correct
14 Correct 62 ms 5456 KB Output is correct
15 Correct 80 ms 5568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 200 ms 7176 KB Output is correct
14 Correct 268 ms 8072 KB Output is correct
15 Correct 62 ms 4756 KB Output is correct
16 Correct 58 ms 5264 KB Output is correct
17 Correct 30 ms 4360 KB Output is correct
18 Correct 35 ms 4348 KB Output is correct
19 Correct 30 ms 4260 KB Output is correct
20 Correct 70 ms 4924 KB Output is correct
21 Correct 31 ms 4284 KB Output is correct
22 Correct 40 ms 4468 KB Output is correct
23 Correct 86 ms 7728 KB Output is correct
24 Correct 69 ms 5708 KB Output is correct
25 Correct 73 ms 5596 KB Output is correct
26 Correct 64 ms 5504 KB Output is correct
27 Correct 57 ms 5464 KB Output is correct
28 Correct 55 ms 5488 KB Output is correct
29 Correct 58 ms 5488 KB Output is correct
30 Correct 63 ms 5552 KB Output is correct
31 Correct 74 ms 5752 KB Output is correct
32 Correct 55 ms 5480 KB Output is correct
33 Correct 85 ms 6504 KB Output is correct
34 Correct 62 ms 5436 KB Output is correct
35 Correct 70 ms 5436 KB Output is correct
36 Correct 62 ms 5456 KB Output is correct
37 Correct 80 ms 5568 KB Output is correct
38 Execution timed out 1083 ms 9112 KB Time limit exceeded
39 Halted 0 ms 0 KB -