제출 #110738

#제출 시각아이디문제언어결과실행 시간메모리
110738TAISA_Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/*void MinMax(ll l, ll r, ll& mi, ll& ma) {
    cout << l << " " << r << endl;
    cin >> mi >> ma;
}*/
ll findGap(ll T, ll N) {
    ll mi, ma;
    ll INF = 100000000000000000LL;
    MinMax(0LL, INF, mi, ma);
    if(N == ma - mi + 1LL) {
        return 1LL;
    }
    ll l = (ma - mi + 1LL) / (N + 1LL) + 1LL, m = (ma - mi + 1LL) % (N + 1LL);
    ll b = mi, res = 0, t = mi, s = 0;
    bool f = false;
    for(int i = 0; i < N + 1; i++) {
        ll nl = l - (i >= m);
        MinMax(t, t + nl - 1LL, mi, ma);
        if(mi == -1) {
            if(f) {
                s += nl;
            } else {
                s += nl + (t - b);
                f = true;
            }
        } else {
            if(f) {
                s += mi - t;
                res = max(res, s);
                s = 0;
                f = false;
            }
            b = ma;
        }
        t += nl;
    }
    return res;
}
/*int main() {
    cout << findGap(0, 4) << endl;
}*/

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

gap.cpp: In function 'll findGap(ll, ll)':
gap.cpp:11:5: error: 'MinMax' was not declared in this scope
     MinMax(0LL, INF, mi, ma);
     ^~~~~~
gap.cpp:11:5: note: suggested alternative: 'rindex'
     MinMax(0LL, INF, mi, ma);
     ^~~~~~
     rindex