제출 #411153

#제출 시각아이디문제언어결과실행 시간메모리
411153eagle30식물 비교 (IOI20_plants)C++14
컴파일 에러
0 ms0 KiB
#include "plants.h" #include<bits/stdc++.h> using namespace std; int pref[1000000], n, tot=0; void init(int k, vector<int> r) { n=r.size(); for(int i=0; i<n; i++){ tot+=r[i]; pref[i+1]=pref[i]+r[i]; } return; } int compare_plants(int x, int y) { int u=pref[y]-pref[x]; if(u==y-x || tot==u){ assert(1!=0) return -1; } else if(u==0 || tot-u==y-x){ return 1; } else{ return 0; } }

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

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:18:3: error: expected ';' before 'return'
   18 |   return -1;
      |   ^~~~~~
plants.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^