Submission #448310

#TimeUsernameProblemLanguageResultExecution timeMemory
448310MOUF_MAHMALATTenis (COI19_tenis)C++14
30 / 100
1091 ms6588 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; 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; } while(q--) { scanf("%d",&t); if(t-1) { scanf("%d%d%d",&z,&x,&y); swap(a[id[x][z]][z],a[id[y][z]][z]); swap(id[x][z],id[y][z]); continue; } scanf("%d",&x); for(ll i=1; i<=3; i++) op[i]=n; dq.push(x); while(!dq.empty()) { x=dq.front(); dq.pop(); for(ll j=1; j<=3; j++) { y=z=id[x][j]; while(y<=op[j]) { dq.push(a[y][j]); y++; } op[j]=min(op[j],z-1); } } sort(op+1,op+4); if(op[1]) printf("NE\n"); else printf("DA\n"); } return 0; }

Compilation message (stderr)

tenis.cpp: In function 'int main()':
tenis.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d",&n,&q);
      |     ~~~~~^~~~~~~~~~~~~~
tenis.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             scanf("%d",&a[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~
tenis.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%d",&t);
      |         ~~~~~^~~~~~~~~
tenis.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             scanf("%d%d%d",&z,&x,&y);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~
tenis.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         scanf("%d",&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...