답안 #28549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28549 2017-07-16T07:13:52 Z not good but never sad(#1132, kriii) LR Springboard (FXCUP2_springboard) C++14
1 / 1
3 ms 2088 KB
#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

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++){
                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2088 KB Output is correct
2 Correct 0 ms 2088 KB Output is correct
3 Correct 0 ms 2088 KB Output is correct
4 Correct 0 ms 2088 KB Output is correct
5 Correct 0 ms 2088 KB Output is correct
6 Correct 0 ms 2088 KB Output is correct
7 Correct 0 ms 2088 KB Output is correct
8 Correct 0 ms 2088 KB Output is correct
9 Correct 0 ms 2088 KB Output is correct
10 Correct 0 ms 2088 KB Output is correct
11 Correct 0 ms 2088 KB Output is correct
12 Correct 0 ms 2088 KB Output is correct
13 Correct 0 ms 2088 KB Output is correct
14 Correct 0 ms 2088 KB Output is correct
15 Correct 0 ms 2088 KB Output is correct
16 Correct 0 ms 2088 KB Output is correct
17 Correct 0 ms 2088 KB Output is correct
18 Correct 0 ms 2088 KB Output is correct
19 Correct 0 ms 2088 KB Output is correct
20 Correct 0 ms 2088 KB Output is correct
21 Correct 0 ms 2088 KB Output is correct
22 Correct 0 ms 2088 KB Output is correct
23 Correct 0 ms 2088 KB Output is correct
24 Correct 0 ms 2088 KB Output is correct
25 Correct 0 ms 2088 KB Output is correct
26 Correct 3 ms 2088 KB Output is correct
27 Correct 0 ms 2088 KB Output is correct
28 Correct 0 ms 2088 KB Output is correct
29 Correct 0 ms 2088 KB Output is correct
30 Correct 0 ms 2088 KB Output is correct
31 Correct 0 ms 2088 KB Output is correct
32 Correct 0 ms 2088 KB Output is correct
33 Correct 0 ms 2088 KB Output is correct
34 Correct 0 ms 2088 KB Output is correct
35 Correct 0 ms 2088 KB Output is correct
36 Correct 0 ms 2088 KB Output is correct
37 Correct 0 ms 2088 KB Output is correct
38 Correct 0 ms 2088 KB Output is correct
39 Correct 0 ms 2088 KB Output is correct
40 Correct 3 ms 2088 KB Output is correct
41 Correct 0 ms 1948 KB Output is correct