# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
871476 |
2023-11-11T01:37:11 Z |
NeroZein |
Tenis (COI19_tenis) |
C++17 |
|
500 ms |
5092 KB |
#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
vector<vector<int>> a(3, vector<int> (n));
vector<vector<int>> idx(3, vector<int> (n));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < n; ++j) {
cin >> a[i][j];
--a[i][j];
idx[i][a[i][j]] = j;
}
}
auto get_first = [&](int x) {
return min({idx[0][x], idx[1][x], idx[2][x]});
};
auto get_last = [&](int x) {
return max({idx[0][x], idx[1][x], idx[2][x]});
};
while (q--) {
int tp;
cin >> tp;
if (tp == 1) {
int x;
cin >> x;
--x;
int f = get_first(x);
int c = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
c = max(c, get_last(a[j][i]));
}
if (c == i) break;
}
cout << (c >= f ? "DA" : "NE") << '\n';
} else {
int p, x, y;
cin >> p >> x >> y;
--p, --x, --y;
int px = idx[p][x];
int py = idx[p][y];
swap(idx[p][x], idx[p][y]);
a[p][px] = y;
a[p][py] = x;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
496 KB |
Output is correct |
13 |
Correct |
22 ms |
4812 KB |
Output is correct |
14 |
Correct |
21 ms |
4848 KB |
Output is correct |
15 |
Correct |
19 ms |
4696 KB |
Output is correct |
16 |
Correct |
20 ms |
4816 KB |
Output is correct |
17 |
Correct |
20 ms |
4940 KB |
Output is correct |
18 |
Correct |
19 ms |
4924 KB |
Output is correct |
19 |
Correct |
18 ms |
4808 KB |
Output is correct |
20 |
Correct |
19 ms |
4812 KB |
Output is correct |
21 |
Correct |
18 ms |
4696 KB |
Output is correct |
22 |
Correct |
19 ms |
4808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
5092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
496 KB |
Output is correct |
13 |
Correct |
22 ms |
4812 KB |
Output is correct |
14 |
Correct |
21 ms |
4848 KB |
Output is correct |
15 |
Correct |
19 ms |
4696 KB |
Output is correct |
16 |
Correct |
20 ms |
4816 KB |
Output is correct |
17 |
Correct |
20 ms |
4940 KB |
Output is correct |
18 |
Correct |
19 ms |
4924 KB |
Output is correct |
19 |
Correct |
18 ms |
4808 KB |
Output is correct |
20 |
Correct |
19 ms |
4812 KB |
Output is correct |
21 |
Correct |
18 ms |
4696 KB |
Output is correct |
22 |
Correct |
19 ms |
4808 KB |
Output is correct |
23 |
Execution timed out |
1062 ms |
5092 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |