제출 #152957

#제출 시각아이디문제언어결과실행 시간메모리
152957Ruxandra985popa (BOI18_popa)C++14
컴파일 에러
0 ms0 KiB
#include <cstdio> #include "popa.h" /// radem glumim dar dc iau runtime int solve (int N , int *Left , int *Right){ /// return root int i,lant,root,bgn,ed,eda; int tt[1010]; for (i=0;i<N;i++){ tt[i] = Left[i] = Right[i] = -1; /// reset all } /// separam in lanturi lant = 1; bgn = ed = 0; eda = -1; /// cel de care poti lipi for (i=1;i<N;i++){ /// n - 1 if (query(bgn , i , i , i)){ /// i apartine lantului curent ed = i; tt[i-1] = i; } else { /// incepem alt lant if ( lant != 1 ){ /// vedem cum il unim if (query(eda , ed , eda , eda)){ tt[ed] = eda; /// unesti intervalele astea #include <cstdio> #include "popa.h" /// cum adc runtime:( int solve (int N , int *Left , int *Right){ /// return root int i,lant,root,bgn,ed,eda; int tt[1010]; for (i=0;i<N;i++){ tt[i] = Left[i] = Right[i] = -1; /// reset all } /// separam in lanturi lant = 1; bgn = ed = 0; eda = -1; /// cel de care poti lipi for (i=1;i<N;i++){ /// n - 1 if (query(bgn , i , i , i)){ /// i apartine lantului curent ed = i; tt[i-1] = i; } else { /// incepem alt lant if ( lant != 1 ){ /// vedem cum il unim if (query(eda , ed , eda , eda)){ tt[ed] = eda; /// unesti intervalele astea } else { /// daca nu pot cu aia , il fac pe ed[i] radacina tt[root] = ed; root = ed; ed--; } } else root = ed; lant++; eda = ed; bgn = ed = i; } } if ( lant != 1 ){ /// vedem cum il unim if (query(eda , ed , eda , eda)){ tt[ed] = eda; /// unesti intervalele astea } else { /// daca nu pot cu aia , il fac pe ed[i] radacina tt[root] = ed; root = ed; ed--; } } else root = ed; /// uniunile dintre lanturi se fac clar la nivelul lui ed /// pentru ca au indici consecutivi in s for (i=0;i<N;i++){ if (0 <= tt[i] && tt[i] < n){ if (Left[tt[i]]==-1) Left[tt[i]] = i; else Right[tt[i]] = i; } } return root; }

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

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:28:43: error: a function-definition is not allowed here before '{' token
 int solve (int N , int *Left , int *Right){ /// return root
                                           ^
popa.cpp:86:1: error: expected '}' at end of input
 }
 ^
popa.cpp:86:1: error: expected '}' at end of input
popa.cpp:86:1: error: expected '}' at end of input
popa.cpp:86:1: error: expected '}' at end of input
popa.cpp:6:16: warning: unused variable 'root' [-Wunused-variable]
     int i,lant,root,bgn,ed,eda;
                ^~~~
popa.cpp:86:1: error: expected '}' at end of input
 }
 ^
popa.cpp:86:1: warning: no return statement in function returning non-void [-Wreturn-type]