제출 #554169

#제출 시각아이디문제언어결과실행 시간메모리
554169QwertyPiGap (APIO16_gap)C++14
100 / 100
94 ms5796 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...