답안 #42241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42241 2018-02-23T22:12:02 Z yusufake 커다란 상품 (IOI17_prize) C++
컴파일 오류
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];// = 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: In function 'int find_best(int)':
prize.cpp:33:18: error: 'ask' was not declared in this scope
  int x[2] = ask(0);
                  ^