Submission #611728

# Submission time Handle Problem Language Result Execution time Memory
611728 2022-07-29T06:58:07 Z 이동현(#8500) Tenis (COI19_tenis) C++17
30 / 100
500 ms 11632 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int NS = (int)1e5 + 4;

int n, q;
int a[3][NS];
vector<int> pos[NS];

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> q;
    for(int i = 0; i < 3; ++i){
        for(int j = 0; j < n; ++j){
            cin >> a[i][j];
            pos[a[i][j]].push_back(j);
        }
    }
    while(q--){
        int x; cin >> x;
        if(x == 1){
            int id; cin >> id;
            int cant = 0;
            vector<int> mx = {0, 0, 0};
            for(int i = 0; a[0][i] != id; ++i){
                mx[1] = max(mx[1], pos[a[0][i]][1]);
                mx[2] = max(mx[2], pos[a[0][i]][2]);
                if(mx[1] <= i && mx[2] <= i){
                    cant = 1;
                    break;
                }
            }
            if(cant) cout << "NE\n";
            else cout << "DA\n";
        }
        else{
            int y, z; cin >> x >> y >> z; --x;
            swap(a[x][pos[y][x]], a[x][pos[z][x]]);
            swap(pos[y][x], pos[z][x]);
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2772 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2772 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 3 ms 2684 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2772 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 2 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2772 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 3 ms 2684 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2772 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 2 ms 2772 KB Output is correct
13 Correct 56 ms 11340 KB Output is correct
14 Correct 67 ms 11372 KB Output is correct
15 Correct 58 ms 11324 KB Output is correct
16 Correct 54 ms 11360 KB Output is correct
17 Correct 45 ms 11424 KB Output is correct
18 Correct 48 ms 11352 KB Output is correct
19 Correct 43 ms 11340 KB Output is correct
20 Correct 51 ms 11332 KB Output is correct
21 Correct 55 ms 11544 KB Output is correct
22 Correct 53 ms 11412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 11632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2772 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 3 ms 2684 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2772 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 2 ms 2772 KB Output is correct
13 Correct 56 ms 11340 KB Output is correct
14 Correct 67 ms 11372 KB Output is correct
15 Correct 58 ms 11324 KB Output is correct
16 Correct 54 ms 11360 KB Output is correct
17 Correct 45 ms 11424 KB Output is correct
18 Correct 48 ms 11352 KB Output is correct
19 Correct 43 ms 11340 KB Output is correct
20 Correct 51 ms 11332 KB Output is correct
21 Correct 55 ms 11544 KB Output is correct
22 Correct 53 ms 11412 KB Output is correct
23 Execution timed out 1090 ms 11632 KB Time limit exceeded
24 Halted 0 ms 0 KB -