제출 #614101

#제출 시각아이디문제언어결과실행 시간메모리
614101sword060Gap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; vector<long long>a; void rec(long long l,long long r){ if(l>r)return; long long c,v; MinMax(l,r,&c,&v); if(c==-1)return; a.push_back(c);a.push_back(v); if(c==v||c==v-1)return; long long ret=2; c++;v--; int m1=c+(v-c)/3,m2=v-(v-c)/3; rec(c,m1);rec(m1,m2);rec(m2,v); return ret; } long long findGap(int q,int x){ if(q==2)rec(0,1e18); else{ long long c=0,v=1e18,zz=x; while(zz&&c<=v){ long long l,r; MinMax(c,v,&l,&r); if(l==-1)break; a.push_back(l);if(l!=r)a.push_back(r); c=l+1;v=r-1;zz-=2; } } sort(a.begin(),a.end()); long long ret=0; for(int i=0;i<(int)a.size()-1;i++)ret=max(ret,a[i+1]-a[i]); return ret; }

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

gap.cpp: In function 'void rec(long long int, long long int)':
gap.cpp:16:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   16 |   return ret;
      |          ^~~