Submission #586903

# Submission time Handle Problem Language Result Execution time Memory
586903 2022-07-01T01:37:33 Z eecs Tenis (COI19_tenis) C++17
30 / 100
500 ms 6268 KB
#include <bits/stdc++.h>
using namespace std;

const int maxn = 100010;
int n, q, p[3][maxn], tmp[3][maxn];

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> q;
    for (int i : {0, 1, 2}) {
        for (int j = 1; j <= n; j++) {
            cin >> p[i][j], tmp[i][p[i][j]] = j;
        }
    }
    while (q--) {
        int op, x, y, z;
        cin >> op >> x;
        if (op == 1) {
            set<int> S;
            for (int i = 1; i <= n; i++) {
                for (int j : {0, 1, 2}) {
                    S.insert(p[j][i]);
                }
                if (S.size() == i) {
                    cout << (S.count(x) ? "DA\n" : "NE\n"); break;
                }
            }
        } else {
            cin >> y >> z, x--;
            swap(p[x][tmp[x][y]], p[x][tmp[x][z]]);
            swap(tmp[x][y], tmp[x][z]);
        }
    }
    return 0;
}

Compilation message

tenis.cpp: In function 'int main()':
tenis.cpp:24:30: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |                 if (S.size() == i) {
      |                     ~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 81 ms 5404 KB Output is correct
14 Correct 106 ms 6268 KB Output is correct
15 Correct 35 ms 3020 KB Output is correct
16 Correct 52 ms 3680 KB Output is correct
17 Correct 21 ms 2644 KB Output is correct
18 Correct 22 ms 2608 KB Output is correct
19 Correct 21 ms 2632 KB Output is correct
20 Correct 22 ms 2544 KB Output is correct
21 Correct 22 ms 2564 KB Output is correct
22 Correct 24 ms 2732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 4832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 81 ms 5404 KB Output is correct
14 Correct 106 ms 6268 KB Output is correct
15 Correct 35 ms 3020 KB Output is correct
16 Correct 52 ms 3680 KB Output is correct
17 Correct 21 ms 2644 KB Output is correct
18 Correct 22 ms 2608 KB Output is correct
19 Correct 21 ms 2632 KB Output is correct
20 Correct 22 ms 2544 KB Output is correct
21 Correct 22 ms 2564 KB Output is correct
22 Correct 24 ms 2732 KB Output is correct
23 Execution timed out 1092 ms 4832 KB Time limit exceeded
24 Halted 0 ms 0 KB -