Submission #575816

#TimeUsernameProblemLanguageResultExecution timeMemory
575816CSQ31The Collection Game (BOI21_swaps)C++17
25 / 100
82 ms560 KiB
#include "swaps.h" #include <bits/stdc++.h> #define sz(a) (int)(a.size()) using namespace std; void solve(int n,int V){ vector<int>cur; vector<int>ans; for(int i=1;i<=n;i++)cur.push_back(i); for(int i=1;i<n;i++){ vector<int>v = cur; while(sz(v)>1){ vector<int>nw; int m = sz(v); for(int j=0;j+1<m;j+=2)schedule(v[j],v[j+1]); vector<int>res = visit(); int c = 0; for(int j=0;j+1<m;j+=2){ if(res[c])nw.push_back(v[j+1]); else nw.push_back(v[j]); c++; } if(m&1)nw.push_back(v.back()); v = nw; } ans.push_back(v.back()); v.clear(); for(int x:cur){ if(x!=ans.back())v.push_back(x); } cur = v; } ans.push_back(cur.back()); reverse(ans.begin(),ans.end()); 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...