# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
534783 | 2022-03-09T01:16:12 Z | NhatMinh0208 | The Collection Game (BOI21_swaps) | C++14 | 0 ms | 0 KB |
#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); }