Submission #430500

#TimeUsernameProblemLanguageResultExecution timeMemory
430500Icebear16The Big Prize (IOI17_prize)C++14
20 / 100
117 ms328 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int find_best(int n){
	double j=0,k=n,h;
	while((k-j)!=1){
		h=ceil(((k-j)/2)+j);
		vector<int> a=ask(h);
		if(a[0]==0 && a[1]==0){
			return h;
			break;
		}else if(a[0]<a[1]){
			if(h==n-2){
				return (n-1);
				break;
			}
			j=ceil((k+j)/2);
		}else if(a[0]>a[1]){
			if(h==1){
				return 0;
				break;
			}
			k=ceil(((k-j)/2)+j);
		}
	}
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...