제출 #61147

#제출 시각아이디문제언어결과실행 시간메모리
61147dukati8Gap (APIO16_gap)C++14
100 / 100
111 ms3552 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i=a; i<int(b); i++) long long findGap(int T, int N) { if (T==1) { vector<long long> vals; long long hi=1e18; long long lo=0; long long ans1,ans2; rep (i,0,(N+1)/2) { assert(lo<=hi); MinMax(lo,hi,&ans1,&ans2); vals.push_back(ans1); vals.push_back(ans2); lo=ans1+1; hi=ans2-1; } sort(vals.begin(),vals.end()); long long maxdist=0; rep (i,0,vals.size()-1) { maxdist=max(maxdist,vals[i+1]-vals[i]); //cout << maxdist << endl; } return maxdist; } if (T==2) { long long NL=N; long long one=1; vector<long long> vals; long long hi,lo; MinMax(0,1e18,&lo,&hi); //Vi har nu max och min för alla tal. long long expdist=(hi-lo+NL-one-one)/(NL-one); vals.push_back(hi); vals.push_back(lo); //if (N==2) return hi-lo; for (long long i=0; i<NL-one;i++) { long long start,stop; start=lo+i*expdist; stop=start+expdist-1; //stop=lo+((i+one)*(hi-lo))/(NL-one); assert(start<=stop); long long ans1,ans2; MinMax(start,stop,&ans1,&ans2); if (ans1!=-1) vals.push_back(ans1); if (ans2!=-1) vals.push_back(ans2); } sort(vals.begin(),vals.end()); long long maxdist=0; rep (i,0,vals.size()-1) maxdist=max(maxdist,vals[i+1]-vals[i]); //assert(maxdist>=expdist); return maxdist; } }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...