# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448311 | 2021-07-29T15:31:27 Z | MOUF_MAHMALAT | Tenis (COI19_tenis) | C++14 | 64 ms | 4328 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 4328 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |