Submission #42242

# Submission time Handle Problem Language Result Execution time Memory
42242 2018-02-23T22:13:40 Z yusufake The Big Prize (IOI17_prize) C++
Compilation error
0 ms 0 KB
#include<bits/stdc++.h> 
using namespace std; 
 
#define _ int v, int tl, int tr, int l, int r
#define tm (tl + tr >> 1)
#define sol v+v,tl,tm,l,r 
#define sag v+v+1,tm+1,tr,l,r 
 
#define mp make_pair 
#define pb push_back 
#define st first 
#define nd second 
 
typedef long long ll; 
typedef pair < int , int > pp; 
const int mod = 1e9 + 7; 
const int N   = 2e5 + 5; 
 
int ans=-1;
 
void f(int l, int r, int x[], int y[]){
	int m = l+r >> 1;
	if(ans != -1) return;
	if(x[0] + x[1] == 0) { ans = l; return; }
	if(y[0] + y[1] == 0) { ans = r; return; }
	if(x[0] + x[1] == y[0] + y[1] && x[1] == y[1]) return; 
	if(l >= r-1) return;
	int a[2];
    a = ask(m);
	f(l,m,x,a); f(m,r,a,y);
}
 
int find_best(int n){
	int x[2] = ask(0);
	//int y[2] = ask(n-1);
	f(0,n-1,x,y);
	return ans;
}

Compilation message

prize.cpp: In function 'void f(int, int, int*, int*)':
prize.cpp:22:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m = l+r >> 1;
           ^
prize.cpp:29:14: error: 'ask' was not declared in this scope
     a = ask(m);
              ^
prize.cpp: In function 'int find_best(int)':
prize.cpp:34:18: error: 'ask' was not declared in this scope
  int x[2] = ask(0);
                  ^
prize.cpp:36:12: error: 'y' was not declared in this scope
  f(0,n-1,x,y);
            ^