이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
long long findGap(int T, int N)
{
ll ans = 0;
if(T == 1){
ll L = -1, R = (ll) 1e18+1;
set<ll> a;
for(int j = 0; j < (N + 1) / 2; j++){
MinMax(L + 1, R - 1, &L, &R);
if(L != -1) a.insert(L); if(R != -1) a.insert(R);
}
for(auto it = a.begin(); it != a.end(); it++){
if(next(it) != a.end()) ans = max(ans, *next(it) - *it);
}
}else{
ll L, R;
MinMax(0, 1e18, &L, &R);
ll tg = 1 + (R - L - 1) / (N - 1);
set<ll> a; a.insert(L); a.insert(R);
for(ll i = L + 1; i < R; i += tg){
ll ll, rr;
MinMax(i, min(R - 1, i + tg - 1), &ll, &rr);
if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
}
for(auto it = a.begin(); it != a.end(); it++){
if(next(it) != a.end()) ans = max(ans, *next(it) - *it);
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
13 | if(L != -1) a.insert(L); if(R != -1) a.insert(R);
| ^~
gap.cpp:13:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
13 | if(L != -1) a.insert(L); if(R != -1) a.insert(R);
| ^~
gap.cpp:26:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
26 | if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
| ^~
gap.cpp:26:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
26 | if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
| ^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |