# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1041655 |
2024-08-02T06:48:25 Z |
vjudge1 |
Tenis (COI19_tenis) |
C++17 |
|
500 ms |
17236 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
void solve(){
ll n , q ,x , y , z;
cin >> n >> q;
int a[3][n + 1];
map<ll,vector<ll>> mp;
for(int i = 0; i< 3 ;i ++){
for(int j = 0; j < n ;j ++){
cin >> a[i][j];
mp[a[i][j]].push_back(j);
}
}
while(q--){
cin >> x;
if(x == 1){
cin >> y;
bool flg = 1;
ll mx1 = 0 , mx2 = 0;
for(int i = 0; i < n ;i ++){
if(a[0][i] == y){
break;
}
mx1 = max(mx1 , mp[a[0][i]][1]);
mx2 = max(mx2 , mp[a[0][i]][2]);
if(mx1 <= i and mx2 <= i){
flg = 0;
break;
}
}
if(flg){
cout << "DA" << '\n';
}
else{
cout << "NE" << '\n';
}
}
else{
cin >> x >> y >> z;
x--;
swap(a[x][mp[y][x]], a[x][mp[z][x]]);
swap(mp[y][x], mp[z][x]);
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int tests = 1;
// cin >> tests;
for (int i = 1; i <= tests; i++){
solve();
}
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 |
348 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 |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
0 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
604 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 |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
0 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
604 KB |
Output is correct |
13 |
Correct |
141 ms |
17124 KB |
Output is correct |
14 |
Correct |
153 ms |
16976 KB |
Output is correct |
15 |
Correct |
100 ms |
16976 KB |
Output is correct |
16 |
Correct |
113 ms |
17052 KB |
Output is correct |
17 |
Correct |
88 ms |
16980 KB |
Output is correct |
18 |
Correct |
96 ms |
17232 KB |
Output is correct |
19 |
Correct |
97 ms |
16980 KB |
Output is correct |
20 |
Correct |
94 ms |
17236 KB |
Output is correct |
21 |
Correct |
92 ms |
16976 KB |
Output is correct |
22 |
Correct |
93 ms |
17232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
17168 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 |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
0 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
604 KB |
Output is correct |
13 |
Correct |
141 ms |
17124 KB |
Output is correct |
14 |
Correct |
153 ms |
16976 KB |
Output is correct |
15 |
Correct |
100 ms |
16976 KB |
Output is correct |
16 |
Correct |
113 ms |
17052 KB |
Output is correct |
17 |
Correct |
88 ms |
16980 KB |
Output is correct |
18 |
Correct |
96 ms |
17232 KB |
Output is correct |
19 |
Correct |
97 ms |
16980 KB |
Output is correct |
20 |
Correct |
94 ms |
17236 KB |
Output is correct |
21 |
Correct |
92 ms |
16976 KB |
Output is correct |
22 |
Correct |
93 ms |
17232 KB |
Output is correct |
23 |
Execution timed out |
1096 ms |
17168 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |