제출 #1260176

#제출 시각아이디문제언어결과실행 시간메모리
1260176Szymon_PilipczukGap (APIO16_gap)C++20
100 / 100
42 ms2240 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define st first #define nd second #define pb push_back #define all(a) a.begin(),a.end() #define rep(a,b) for(int a = 0;a<b;a++) const int inf = 1e9; const ll infl = 1e18; ll findGap(int t,int n) { if(t == 1) { vector<ll> cc; ll a = 0,b = infl; ll c,d; rep(i,(n+1)/2) { MinMax(a,b,&c,&d); cc.pb(c); if(c != d)cc.pb(d); a = c+1; b = d-1; } sort(all(cc)); ll ans = 0; rep(i,n-1) { ans = max(ans,cc[i+1]-cc[i]); } return ans; } else if(t == 2) { ll ans = 0; ll a,b; MinMax(0LL,infl,&a,&b); ll minans = (b-a + n-2)/(n-1); ll prev = a; for(ll i = a+1;i<b;i += minans+1) { ll c,d; MinMax(i,min(i+minans,b-1),&c,&d); if(c == -1) continue; ans = max(ans,c-prev); prev = d; } ans = max(ans,b-prev); return ans; } }

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

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