Submission #28626

#TimeUsernameProblemLanguageResultExecution timeMemory
28626ㅁㄴㅇㄹ (#68)LR Springboard (FXCUP2_springboard)C++14
0 / 1
3 ms2348 KiB
#include "springboard.h" #include <bits/stdc++.h> using namespace std; int l[20000],r[20000],tl[20000],tr[20000]; void Reorder(int N) { int in = N; for(int i=1; i<=N; i++){ l[i] = r[i] = i; } int get,rear; while(N != 1){ int m = (N+1)/2; get = PutBall(l[m]); if(get == -1){ rear = 1; tl[1] = l[1]; tr[1] = l[m]; if(l[m] != r[m]){ rear++; tl[rear] = l[m]+1; tr[rear] = r[m]; } for(int i=m+1; i<=N; i++){ rear++; tl[rear] = l[i]; tr[rear] = r[i]; } N = rear; }else{ rear = 0; for(int i=1; i<m; i++){ rear++; tl[rear] = l[i]; tr[rear] = r[i]; } rear++; tl[rear] = l[m]; tr[rear] = r[N]; N = rear; } } get = PutBall(1); if(get == -1){ PutBall(in); } }
#Verdict Execution timeMemoryGrader output
Fetching results...