제출 #70286

#제출 시각아이디문제언어결과실행 시간메모리
70286E869120커다란 상품 (IOI17_prize)C++14
0 / 100
4 ms572 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int find_best(int n) {
	int cx = 0;
	
	while (true) {
		vector<int> X1 = ask(cx);
		
		int L = cx, R = n, M, maxn = 0, QQ = 18;
		
		vector<int> X2 = ask(min(n - 1, cx + 1023));
		if(X2 != X1) { R = min(n, cx + 1023); QQ = 10; }
		
		while (R - L > 1) {
			M = (L + R) / 2;
			vector<int> R1 = ask(min(n, M));
			if (R1[0] + R1[1] == 0) return M;
			if (X1 == R1) { L = M; maxn = max(maxn, M); }
			else { R = M; }
		}
		cx = maxn + 2;
	}
	return -1;
}

컴파일 시 표준 에러 (stderr) 메시지

prize.cpp: In function 'int find_best(int)':
prize.cpp:11:35: warning: variable 'QQ' set but not used [-Wunused-but-set-variable]
   int L = cx, R = n, M, maxn = 0, QQ = 18;
                                   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...