# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448312 | 2021-07-29T15:34:46 Z | MOUF_MAHMALAT | Tenis (COI19_tenis) | C++14 | 86 ms | 6436 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]==0) 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 | Correct | 62 ms | 3780 KB | Output is correct |
2 | Correct | 82 ms | 6316 KB | Output is correct |
3 | Correct | 69 ms | 6340 KB | Output is correct |
4 | Correct | 62 ms | 6232 KB | Output is correct |
5 | Correct | 86 ms | 6240 KB | Output is correct |
6 | Correct | 62 ms | 6184 KB | Output is correct |
7 | Correct | 65 ms | 6236 KB | Output is correct |
8 | Correct | 64 ms | 6212 KB | Output is correct |
9 | Correct | 64 ms | 6436 KB | Output is correct |
10 | Correct | 61 ms | 6212 KB | Output is correct |
11 | Correct | 63 ms | 6272 KB | Output is correct |
12 | Correct | 62 ms | 6260 KB | Output is correct |
13 | Correct | 63 ms | 6212 KB | Output is correct |
14 | Correct | 60 ms | 6236 KB | Output is correct |
15 | Correct | 61 ms | 6292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |