# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1041720 |
2024-08-02T07:24:00 Z |
vjudge1 |
Tenis (COI19_tenis) |
C++17 |
|
500 ms |
2864 KB |
/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#include <iostream>
#include <set>
#include <vector>
using namespace std;
inline void solve()
{
int n,q;
cin>>n>>q;
int loc[3][n];
for (int i=0;i<3;i++)
{
for (int j=0;j<n;j++)
{
int x;
cin>>x;
loc[i][x-1]=j;
}
}
while (q--)
{
int ty;
cin>>ty;
if (ty==1)
{
int x;
cin>>x;
x--;
int mind[3]={loc[0][x],loc[1][x],loc[2][x]};
vector<int>f;
for (int i=0;i<n;i++)
if (i!=x)
f.push_back(i);
while (f.size())
{
vector<int>g;
for (auto i:f)
{
bool w=1;
for (int k=0;k<3;k++)
{
if (mind[k]<loc[k][i])
{
w=0;
for (int j=0;j<3;j++)
mind[j]=min(mind[j],loc[j][i]);
break;
}
}
if (w)
g.push_back(i);
}
if (f.size()==g.size())
break;
f=g;
}
if (f.size())
cout<<"NE\n";
else
cout<<"DA\n";
}
else
{
int p,a,b;
cin>>p>>a>>b;
p--;a--;b--;
swap(loc[p][a],loc[p][b]);
}
}
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
solve();
}
# |
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 |
344 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 |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 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 |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
423 ms |
2444 KB |
Output is correct |
14 |
Correct |
132 ms |
2812 KB |
Output is correct |
15 |
Correct |
43 ms |
2388 KB |
Output is correct |
16 |
Correct |
97 ms |
2612 KB |
Output is correct |
17 |
Correct |
21 ms |
2388 KB |
Output is correct |
18 |
Correct |
16 ms |
2512 KB |
Output is correct |
19 |
Correct |
25 ms |
2392 KB |
Output is correct |
20 |
Correct |
18 ms |
1372 KB |
Output is correct |
21 |
Correct |
24 ms |
2740 KB |
Output is correct |
22 |
Correct |
370 ms |
2388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1070 ms |
2864 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 |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
423 ms |
2444 KB |
Output is correct |
14 |
Correct |
132 ms |
2812 KB |
Output is correct |
15 |
Correct |
43 ms |
2388 KB |
Output is correct |
16 |
Correct |
97 ms |
2612 KB |
Output is correct |
17 |
Correct |
21 ms |
2388 KB |
Output is correct |
18 |
Correct |
16 ms |
2512 KB |
Output is correct |
19 |
Correct |
25 ms |
2392 KB |
Output is correct |
20 |
Correct |
18 ms |
1372 KB |
Output is correct |
21 |
Correct |
24 ms |
2740 KB |
Output is correct |
22 |
Correct |
370 ms |
2388 KB |
Output is correct |
23 |
Execution timed out |
1070 ms |
2864 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |