Submission #430500

# Submission time Handle Problem Language Result Execution time Memory
430500 2021-06-16T14:49:29 Z Icebear16 The Big Prize (IOI17_prize) C++14
20 / 100
117 ms 328 KB
#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

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 time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 284 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 284 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 280 KB Output is correct
6 Correct 1 ms 284 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 284 KB Output is correct
9 Correct 1 ms 280 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Incorrect 117 ms 200 KB Incorrect
12 Halted 0 ms 0 KB -