Submission #83037

# Submission time Handle Problem Language Result Execution time Memory
83037 2018-11-04T09:53:12 Z ioilolcom The Big Prize (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;
      ^~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 -