Submission #448312

#TimeUsernameProblemLanguageResultExecution timeMemory
448312MOUF_MAHMALATTenis (COI19_tenis)C++14
21 / 100
86 ms6436 KiB
#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 (stderr)

tenis.cpp: In function 'int main()':
tenis.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d",&n,&q);
      |     ~~~~~^~~~~~~~~~~~~~
tenis.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             scanf("%d",&a[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~
tenis.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |         scanf("%d%d",&t,&x);
      |         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...