Submission #466024

#TimeUsernameProblemLanguageResultExecution timeMemory
466024Rafi22The Collection Game (BOI21_swaps)C++14
0 / 100
1 ms256 KiB
#include <bits/stdc++.h> #include "swaps.h" using namespace std; #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define ll long long ll mod=1000000007; int inf=1000000007; ll infl=1000000000000000007; bool was[507]; void solve(int n,int v) { vector<int>ans(n); for(int i=0;i<n;i++) ans[i]=i+1; int p=3; while(v--) { memset(was,0,sizeof was); for(int i=n;i>1;i--) { if(was[i]) continue; int l=p; while(i-(1<<l)<=0) l--; schedule(ans[i-(1<<l)-1],ans[i-1]); was[i-(1<<l)]=1; } vector<int>vec=visit(); int it=0; for(int i=n;i>1;i--) { if(was[i]) continue; int l=p; while(i-(1<<l)<=0) l--; if(!vec[it++]) swap(ans[i-(1<<l)-1],ans[i-1]); } p--; if(p==-1) p=3; } 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...