Submission #251398

# Submission time Handle Problem Language Result Execution time Memory
251398 2020-07-21T06:40:15 Z nafis_shifat The Big Prize (IOI17_prize) C++14
20 / 100
72 ms 364 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
int find_best(int n) {
	int ind=0;
	int pos=0;
	for(int i=0;i<n;i=pos+1) {
		vector<int> r=ask(i);
		if(r[0]+r[1]==0)return i;

		int lo=i+1;
		int hi=n-1;
		
		

		while(lo<=hi) {
			int mid=lo+hi>>1;
			vector<int> tmp=ask(mid);

			if(tmp[0]+tmp[1]==0)return mid;

			if(tmp[0]> r[0] || (tmp[0]==r[0] && r[1]>tmp[1])) {
				pos=mid;
				hi=mid-1;
			}else {
				lo=mid+1;
				
			}
		}

	}
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:17:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    int mid=lo+hi>>1;
            ~~^~~
prize.cpp:5:6: warning: unused variable 'ind' [-Wunused-variable]
  int ind=0;
      ^~~
prize.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 6 ms 256 KB Output is correct
14 Correct 3 ms 256 KB Output is correct
15 Incorrect 72 ms 256 KB Incorrect
16 Halted 0 ms 0 KB -