Submission #28549

#TimeUsernameProblemLanguageResultExecution timeMemory
28549not good but never sad (#68)LR Springboard (FXCUP2_springboard)C++14
1 / 1
3 ms2088 KiB
#include "springboard.h" #include <vector> using namespace std; void Reorder(int N) { PutBall((N+1)/2); vector<int> cand; if (PutBall((N+1)/2) == -1){ for (int i=(N+1)/2;i<=N;i++) cand.push_back(i); } else{ for (int i=0;i<(N+1)/2;i++) cand.push_back(i); } while (cand.size() > 1){ int step = (cand.size() + 1) / 2; if (cand.back() != N) step = N + 1 - step; int r = PutBall(step); vector<int> ncand; for (int i=0;i<cand.size();i++){ int nxt = (cand[i] + step) % (N+1); if ((cand[i] - nxt) * r > 0) ncand.push_back(nxt); } cand = ncand; } int push = N-cand[0]+1; if (1 <= push && push <= N) PutBall(push); }

Compilation message (stderr)

springboard.cpp: In function 'void Reorder(int)':
springboard.cpp:21:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0;i<cand.size();i++){
                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...