# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424857 | 2021-06-12T10:54:50 Z | zoooma13 | The Collection Game (BOI21_swaps) | C++14 | 0 ms | 0 KB |
#include "swaps.h" using namespace std; void solve(int N, int V) { vector <int> ord(N); iota(ord.begin() ,ord.end() ,1); for(int t = 0; t < V; t++){ for(int i = t&1; i+1 < N; i += 2) schedule(ord[i] ,ord[i+1]); auto res = visit(); for(int j = 0 ,i = t&1; i+1 < N; i += 2 ,j++) if(!res[j]) swap(ord[i] ,ord[i+1]); } answer(ord); }