Submission #28442

#TimeUsernameProblemLanguageResultExecution timeMemory
28442AcornCkiGuiziTeam (#68)LR Springboard (FXCUP2_springboard)C++11
1 / 1
3 ms1132 KiB
#include "springboard.h"
#include <stdio.h>

void Reorder(int N) {
    int a = PutBall((N+1)/2);
    int b = PutBall((N+1)/2);
    if(a == b) {
        if(a == -1) PutBall(1);
        return;
    }
    int L = (N+1) / 2, state = a;
    while(L) {
        int x = (L + 1) / 2;
        if(state == 1) {
            int t = PutBall(x);
            if(t == 1) {
                L = x - 1;
                state = 2;
            }
            else {
                L = L - x;
            }
        }
        else {
            int t = PutBall(N + 1 - x);
            if(t == -1) {
                L = x - 1;
                state = 1;
            }
            else {
                L = L - x;
            }
        }
    }
    if(state == 1) PutBall(1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...