# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448311 | MOUF_MAHMALAT | Tenis (COI19_tenis) | C++14 | 64 ms | 4328 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
using namespace std;
typedef int ll;
ll n,q,a[100009][4],id[100009][4],t,op[4],x,y,z;
queue<ll>dq;
bool b[100009];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
scanf("%d%d",&n,&q);
for(ll j=1; j<=3; j++)
for(ll i=1; i<=n; i++)
{
scanf("%d",&a[i][j]);
id[a[i][j]][j]=i;
}
for(ll j=1; j<=3; j++)
dq.push(a[1][j]),b[a[1][j]]=1;
while(!dq.empty())
{
t=dq.front();
dq.pop();
for(ll j=1; j<=3; j++)
{
for(ll i=op[j]+1;i<=id[t][j]; i++)
{
dq.push(a[i][j]);
b[a[i][j]]=1;
}
op[j]=max(op[j],id[t][j]);
}
}
while(q--)
{
scanf("%d%d",&t,&x);
if(b[x])
printf("NE\n");
else
printf("DA\n");
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |