제출 #401966

#제출 시각아이디문제언어결과실행 시간메모리
401966Maqsut_03Gap (APIO16_gap)C++14
30 / 100
54 ms1920 KiB
#include "gap.h" #include<bits/stdc++.h> #define ll long long using namespace std; long long findGap(int T, int N) { if(T == 1) { vector<long long> a; a.reserve(N); long long s = 0, e = 1e18; while(int(a.size()) < N) { MinMax(s, e, &s, &e); assert(s != -1); a.push_back(s); a.push_back(e); ++s; --e; } sort(a.begin(), a.end()); long long ans = 0; for(int i = 0; i < int(a.size()) - 1; ++i) ans = max(ans, a[i + 1] - a[i]); return ans; } /* long long a1 = 0, aN = 0; MinMax(0, (long long)1e18, &a1, &aN); long long d = (aN - a1 + N - 2) / (N - 1), ans = d; for(long long i=a1, p=a1; i<=aN; i+=d+1) { long long s = 0, e = 0; MinMax(i, min(i + d, aN), &s, &e); if(~s) ans = max(ans, s - p), p = e; } return ans;*/ }

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

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