Submission #444325

#TimeUsernameProblemLanguageResultExecution timeMemory
444325blueThe Collection Game (BOI21_swaps)C++17
50 / 100
67 ms508 KiB
#include "swaps.h" #include <vector> using namespace std; int N; int V; void solve(int n, int v1) { N = n; V = v1; vector<int> r(N); for(int i = 1; i <= N; i++) r[i - 1] = i; for(int v = 1; v <= min(V, N); v++) { if(v % 2 == 0) { for(int i = 0; i+1 < N; i += 2) schedule(r[i], r[i+1]); vector<int> C = visit(); for(int i = 0; i+1 < N; i += 2) if(C[i/2] == 0) swap(r[i+1], r[i]); } else { for(int i = 1; i+1 < N; i += 2) schedule(r[i], r[i+1]); vector<int> C = visit(); for(int i = 1; i+1 < N; i += 2) if(C[i/2] == 0) swap(r[i+1], r[i]); } } answer(r); }
#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...