Submission #1048220

# Submission time Handle Problem Language Result Execution time Memory
1048220 2024-08-08T05:34:16 Z LittleOrange The Big Prize (IOI17_prize) C++17
20 / 100
1 ms 600 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
int find_best(int n) {
	ll l = 0, r = n-1;
	while(l<r){
		ll m = l+r>>1;
		auto o = ask(m);
		if (o[0]+o[1]==0){
			return m;
		}
		if (o[0]){
			r = m-1;
		}else{
			l = m+1;
		}
	}
	return l;
	for(int i = 0; i < n; i++) {
		std::vector<int> res = ask(i);
		if(res[0] + res[1] == 0)
			return i;
	}
	return 0;
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:8:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    8 |   ll m = l+r>>1;
      |          ~^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 424 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 432 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 424 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 1 ms 344 KB answer is not correct
12 Halted 0 ms 0 KB -