제출 #145629

#제출 시각아이디문제언어결과실행 시간메모리
145629karmaGap (APIO16_gap)C++11
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "gap.h"
#define ll   long long

using namespace std;

const ll oo = (ll)1e18;

ll findGap(int T, int N)
{
   ll Min, Max, preMin, preMax, res = 0;
   MinMax(0, oo, &Min, &Max);
   vector<ll> v; v.clear();
   if(T == 1) {
     int i = 1, j = N - 2;
     v.emplace_back(Min), v.emplace_back(Max);
     while(i <= j) {
         MinMax(preMin + 1, preMax - 1, &Min, &Max);
         if(Min != -1) v.emplace_back(Min); v.emplace_back(Max);
         else break;
         preMin = Min, preMax = Max;
         ++i, --j;
     }
   } else {
     preMin = Min, preMax = Max;
     ll dis = (Max - Min + N - 2) / (N - 1) + 1; res = dis - 1;
     for(ll pos = preMin + 1; pos < preMax; pos += dis) {
        MinMax(pos, pos + res, &Min, &Max);
        if(Min != -1) v.emplace_back(Min), v.emplace_back(Max);
     }
   }
   sort(v.begin(), v.end());
   for(int i = 1; i < int(v.size()); ++i) res = max(res, v[i] - v[i - 1]);
   return res;
}

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:19:10: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
          if(Min != -1) v.emplace_back(Min); v.emplace_back(Max);
          ^~
gap.cpp:19:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
          if(Min != -1) v.emplace_back(Min); v.emplace_back(Max);
                                             ^
gap.cpp:20:10: error: 'else' without a previous 'if'
          else break;
          ^~~~