답안 #28897

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28897 2017-07-17T12:56:23 Z kdh9949 LR Springboard (FXCUP2_springboard) C++14
1 / 1
3 ms 2300 KB
#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());
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2300 KB Output is correct
2 Correct 3 ms 2300 KB Output is correct
3 Correct 3 ms 2300 KB Output is correct
4 Correct 3 ms 2300 KB Output is correct
5 Correct 3 ms 2300 KB Output is correct
6 Correct 3 ms 2300 KB Output is correct
7 Correct 3 ms 2300 KB Output is correct
8 Correct 3 ms 2300 KB Output is correct
9 Correct 3 ms 2300 KB Output is correct
10 Correct 3 ms 2300 KB Output is correct
11 Correct 3 ms 2300 KB Output is correct
12 Correct 3 ms 2300 KB Output is correct
13 Correct 3 ms 2300 KB Output is correct
14 Correct 3 ms 2300 KB Output is correct
15 Correct 3 ms 2300 KB Output is correct
16 Correct 3 ms 2300 KB Output is correct
17 Correct 3 ms 2300 KB Output is correct
18 Correct 3 ms 2300 KB Output is correct
19 Correct 3 ms 2300 KB Output is correct
20 Correct 3 ms 2300 KB Output is correct
21 Correct 3 ms 2300 KB Output is correct
22 Correct 3 ms 2300 KB Output is correct
23 Correct 3 ms 2300 KB Output is correct
24 Correct 3 ms 2300 KB Output is correct
25 Correct 3 ms 2300 KB Output is correct
26 Correct 3 ms 2300 KB Output is correct
27 Correct 3 ms 2300 KB Output is correct
28 Correct 3 ms 2300 KB Output is correct
29 Correct 3 ms 2300 KB Output is correct
30 Correct 3 ms 2300 KB Output is correct
31 Correct 3 ms 2300 KB Output is correct
32 Correct 3 ms 2300 KB Output is correct
33 Correct 3 ms 2300 KB Output is correct
34 Correct 3 ms 2300 KB Output is correct
35 Correct 3 ms 2300 KB Output is correct
36 Correct 3 ms 2300 KB Output is correct
37 Correct 3 ms 2300 KB Output is correct
38 Correct 3 ms 2300 KB Output is correct
39 Correct 3 ms 2300 KB Output is correct
40 Correct 3 ms 2300 KB Output is correct
41 Correct 0 ms 2036 KB Output is correct