Submission #299907

#TimeUsernameProblemLanguageResultExecution timeMemory
299907pacha2880The Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define md(a, b)		((a) % b + b) % b
#define mod(a)			md(a, MOD)
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define forn(i, n)			for(int i = 0; i < n; i++)
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
//int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef long long 		ll;
typedef long double ld;	
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1); 

int find_best(int n)
{
	int lo = 0, hi = n - 1, mid, res;
	int ar[2];
	while(lo <= hi)
	{
		mid = (lo + hi) / 2;
		ar = ask(mid);
		if(ar[0] == 0 && ar[1] == 0) return mid;
		if(ar[0] == 1)
			hi = mid - 1;
		else
			lo = mid + 1;
	}
}


// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2	

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:44:8: error: 'ask' was not declared in this scope
   44 |   ar = ask(mid);
      |        ^~~
prize.cpp:39:31: warning: unused variable 'res' [-Wunused-variable]
   39 |  int lo = 0, hi = n - 1, mid, res;
      |                               ^~~
prize.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
   51 | }
      | ^