Submission #869355

#TimeUsernameProblemLanguageResultExecution timeMemory
869355Trisanu_DasThe Collection Game (BOI21_swaps)C++17
100 / 100
4 ms1208 KiB
#include <bits/stdc++.h> using namespace std; #include "swaps.h" void solve(int n, int v) { vector<int> sus; vector<int> res; for (int i=1;i<=n;i++) sus.push_back(i); for (int t=0;t<9;t++) for (int k=t;k>=0;k--) { for (int i=0;i<n;i++) if ((((i>>k)&1)==(k-t!=0)) && (i+(1<<k)<n) && (((i+(1<<k))>>(t+1))==(i>>(t+1)))) { schedule(sus[i],sus[i+(1<<k)]); } res=visit(); int j=0; for (int i=0;i<n;i++) if ((((i>>k)&1)==(k-t!=0)) && (i+(1<<k)<n) && (((i+(1<<k))>>(t+1))==(i>>(t+1)))) { if (res[j]==0) swap(sus[i],sus[i+(1<<k)]); j++; } } answer(sus); }
#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...