# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1041692 |
2024-08-02T07:08:51 Z |
vjudge1 |
Tenis (COI19_tenis) |
C++17 |
|
500 ms |
2768 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)
{
vector<int>f;
int x;
cin>>x;
x--;
for (int i=0;i<n;i++)
{
if (i!=x)
f.push_back(i);
}
vector<int>z;
z.push_back(x);
while (f.size())
{
vector<int>g,h;
for (auto i:f)
{
for (auto j:z)
{
bool w=0;
for (int k=0;k<3;k++)
{
if (loc[k][j]<loc[k][i])
{
w=1;break;
}
}
if (w)
{
g.push_back(i);
break;
}
}
if (g.size()&&g.back()!=i)
h.push_back(i);
}
if (g.size()==0)
break;
z=g,f=h;
}
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 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
2768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |