Submission #28897

#TimeUsernameProblemLanguageResultExecution timeMemory
28897kdh9949LR Springboard (FXCUP2_springboard)C++14
1 / 1
3 ms2300 KiB
#include "springboard.h" #include <bits/stdc++.h> using namespace std; vector<int> fv, rv; set<int> ss; void Reorder(int N){ PutBall((N + 1) / 2); int t = PutBall((N + 1) / 2); int s, e; if(t == -1){ s = (N + 1) / 2; e = N; } else{ s = 0; e = (N - 1) / 2; } for(int i = s; i <= e; i++) ss.insert(i); while(ss.size() > 1){ fv.clear(); rv.clear(); int c = int(ss.size()) / 2; for(int i = 0; i < c; i++){ fv.push_back(*ss.begin()); ss.erase(ss.begin()); } while(!ss.empty()){ rv.push_back(*ss.begin()); ss.erase(ss.begin()); } int m = N - fv.back(); int t = PutBall(m); if(t == -1) rv.clear(); else fv.clear(); for(auto &i : fv) ss.insert((i + m) % (N + 1)); for(auto &i : rv) ss.insert((i + m) % (N + 1)); } if(*ss.begin()) PutBall(N + 1 - *ss.begin()); }
#Verdict Execution timeMemoryGrader output
Fetching results...