제출 #359310

#제출 시각아이디문제언어결과실행 시간메모리
359310shahriarkhanXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "xylophone.h" using namespace std ; void solve(int N) { int A[N+2] = {0} , vis[N+2] = {0} , low = 1 , high = N ; while(low<high) { int mid = (low+high+1)>>1 ; if(query(mid,N)==(N-1)) low = mid ; else high = mid - 1 ; } A[low] = 1 , vis[1] = 1 ; for(int i = low - 1 ; i >= 1 ; --i) { int temp = query(i,i+1) , left = A[i+1] - temp , right = A[i+1] + temp ; if((left>0 && left<=N) && (!vis[left])) { vis[left] = 1 ; A[i] = left ; } else if((right>0 && right<=N) && (!vis[right])) { vis[right] = 1 ; A[i] = right ; } else { temp = query(i,i+2) ; if((max(left,A[i+2])-min(A[i+1],A[i+2]))==temp) { vis[left] = 1 ; A[i] = left ; } else { vis[right] = 1 ; A[i] = right ; } } } for(int i = low + 1 ; i <= N ; ++i) { int temp = query(i-1,i) , left = A[i-1] - temp , right = A[i-1] + temp ; if((left>0 && left<=N) && (!vis[left])) { vis[left] = 1 ; A[i] = left ; } else if((right>0 && right<=N) && (!vis[right])) { vis[right] = 1 ; A[i] = right ; } else { temp = query(i-2,i) ; if((max(left,A[i-2])-min(A[i-1],A[i-2]))==temp) { vis[left] = 1 ; A[i] = left ; } else { vis[right] = 1 ; A[i] = right ; } } } for(int i = 1; i <= N; i++) { answer(i, A[i]) ; }

컴파일 시 표준 에러 (stderr) 메시지

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:74:2: error: expected '}' at end of input
   74 |  }
      |  ^
xylophone.cpp:5:19: note: to match this '{'
    5 | void solve(int N) {
      |                   ^