# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648385 | 2022-10-06T09:53:46 Z | berr | The Collection Game (BOI21_swaps) | C++17 | 1 ms | 336 KB |
#include <bits/stdc++.h> #include "swaps.h" using namespace std; void solve(int N, int V) { deque<vector<int>> ans(1); for(int i=1; i<=N; i++) { ans[0].push_back(i); } int l=0, r=N-1; vector<int> q(N); while(ans.size()!=1||ans[0].size()!=1) { for(int i=0; i<ans.size(); i++) { for(int l=0; l<ans[i].size()-1; l+=2) { schedule(ans[i][l], ans[i][l+1]); } } deque<vector<int>> br(ans.size()+1); auto b=visit(); int f=0; for(int i=0; i<ans.size(); i++) { for(int l=0; l<ans[i].size()-1; l+=2) { if(b[f]==1) br[i].push_back(ans[i][l]), br[i+1].push_back(ans[i][l+1]); else br[i].push_back(ans[i][l+1]), br[i+1].push_back(ans[i][l]); f++; } if(ans[i].size()%2) br[i].push_back(ans[i][ans[i].size()-1]); } ans=br; int k=0; while(ans.size()&&ans[0].size()==1) { q[l]=ans[0][0]; ans.pop_front(); l++; } while(ans.size()&&ans[ans.size()-1].size()==1) { q[r]=ans[ans.size()-1][0]; ans.pop_back(); r--; } } answer(q); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |