답안 #134429

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134429 2019-07-22T16:40:37 Z thanos popa (BOI18_popa) C++14
컴파일 오류
0 ms 0 KB
#include<iostream>
using namespace std;
int solve(int N,int* Left,int* Right){
  for(int i=0; i<N; i++){
    if(query(0,i-1,i+1,N-1){
      cout<<i;
      break;
    }
  }
  myway(0,N,Left,Right);
}
int myway(int l,int r,int* Left,int* Right){
  if(l>r) return -1;
  if(l==r){
    Left[l]=-1;
    Right[l]=-1;
    return l;
  }
  int g=-1;
  for(int i=l; i<=r; i++){
    if(query(l,i-1,i+1,r){
      Left[i]=myway(l,i-1);
      Right[i]=myway(i+1,r);
      break;
    }
  }
  return g;
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:5:8: error: 'query' was not declared in this scope
     if(query(0,i-1,i+1,N-1){
        ^~~~~
popa.cpp:5:28: error: expected ')' before '{' token
     if(query(0,i-1,i+1,N-1){
                            ^
popa.cpp:9:3: error: expected primary-expression before '}' token
   }
   ^
popa.cpp:10:3: error: 'myway' was not declared in this scope
   myway(0,N,Left,Right);
   ^~~~~
popa.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
popa.cpp: In function 'int myway(int, int, int*, int*)':
popa.cpp:21:8: error: 'query' was not declared in this scope
     if(query(l,i-1,i+1,r){
        ^~~~~
popa.cpp:21:26: error: expected ')' before '{' token
     if(query(l,i-1,i+1,r){
                          ^
popa.cpp:26:3: error: expected primary-expression before '}' token
   }
   ^