Submission #110251

# Submission time Handle Problem Language Result Execution time Memory
110251 2019-05-10T10:26:11 Z icandoit The Big Prize (IOI17_prize) C++14
20 / 100
89 ms 448 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 392 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 308 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 2 ms 388 KB Output is correct
8 Correct 2 ms 304 KB Output is correct
9 Correct 2 ms 312 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 308 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 7 ms 412 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 2 ms 312 KB Output is correct
8 Correct 2 ms 308 KB Output is correct
9 Correct 3 ms 320 KB Output is correct
10 Correct 2 ms 300 KB Output is correct
11 Incorrect 89 ms 448 KB Incorrect
12 Halted 0 ms 0 KB -