Submission #429719

#TimeUsernameProblemLanguageResultExecution timeMemory
429719mosiashvililukaThe Collection Game (BOI21_swaps)C++14
25 / 100
119 ms440 KiB
#include "swaps.h" #include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,V,bo[5009],p[5009],pi,q[5009],qi; vector <int> vv,ans; void solve(int N, int VV) { a=N;V=VV; for(ii=1; ii<a; ii++){ pi=0; for(i=1; i<=a; i++){ if(bo[i]==1) continue; pi++;p[pi]=i; } while(pi!=1){ for(i=1; i<pi; i+=2){ schedule(p[i],p[i+1]); } vv=visit(); qi=0; j=-1; for(i=1; i<pi; i+=2){ j++; if(vv[j]==1){ qi++;q[qi]=p[i]; }else{ qi++;q[qi]=p[i+1]; } } if(pi%2==1){ qi++;q[qi]=p[pi]; } pi=qi; for(i=1; i<=pi; i++){ p[i]=q[i]; } } ans.push_back(p[1]); bo[p[1]]=1; } for(i=1; i<=a; i++){ if(bo[i]==0){ ans.push_back(i);break; } } answer(ans); }
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...