Submission #105783

# Submission time Handle Problem Language Result Execution time Memory
105783 2019-04-14T17:16:31 Z RezwanArefin01 The Big Prize (IOI17_prize) C++17
20 / 100
3 ms 512 KB
#include <bits/stdc++.h>
#include "prize.h"
using namespace std; 

int find_best(int n) {
	int lo = 0, hi = n - 1;
	while(lo <= hi) {
		int mid = lo + hi >> 1; 
		vector<int> a = ask(mid);
		if(a[0] + a[1] == 0) return mid; 
		if(a[0]) hi = mid - 1; 
		else lo = mid + 1; 
	}
	return -1; 
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:8:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int mid = lo + hi >> 1; 
             ~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 396 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 428 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Incorrect 2 ms 256 KB Integer -1 violates the range [0, 199999]
12 Halted 0 ms 0 KB -