#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 == 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:33:1: warning: control reaches end of non-void function [-Wreturn-type]
33 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |