Submission #448309

#TimeUsernameProblemLanguageResultExecution timeMemory
448309MOUF_MAHMALATIzlet (COI19_izlet)C++11
0 / 100
2 ms332 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)

izlet.cpp: In function 'int main()':
izlet.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);
      |     ~~~~~^~~~~~~~~~~~~~
izlet.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]);
      |             ~~~~~^~~~~~~~~~~~~~~
izlet.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%d",&t);
      |         ~~~~~^~~~~~~~~
izlet.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);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~
izlet.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...