답안 #83037

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83037 2018-11-04T09:53:12 Z ioilolcom 커다란 상품 (IOI17_prize) C++14
20 / 100
63 ms 576 KB
#include "prize.h"

int find_best(int n) {

	int l=0;
	int r=n-1;
	int mid;
	while(l<=r) {
		mid=(l+r)/2;
		std::vector<int> res = ask(mid);
		if(res[1]==1) {
			l=mid+1;
		}
		else if(res[0]==1) {
			r=mid-1;
		}
		else if(res[0]==0&&res[1]==0) {
			return mid;
		}


	}
	return mid;
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:7:6: warning: 'mid' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int mid;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 324 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 400 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 528 KB Output is correct
7 Correct 2 ms 528 KB Output is correct
8 Correct 2 ms 528 KB Output is correct
9 Correct 2 ms 556 KB Output is correct
10 Correct 2 ms 556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 556 KB Output is correct
2 Correct 2 ms 572 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Correct 2 ms 572 KB Output is correct
5 Correct 2 ms 572 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 576 KB Output is correct
9 Correct 2 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Incorrect 63 ms 576 KB Incorrect
12 Halted 0 ms 0 KB -