제출 #464762

#제출 시각아이디문제언어결과실행 시간메모리
464762Killer2501Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "asd"
#define pll pair<ll, ll>
#define pii pair<pll, ll>
#define fi first
#define se second
#include "gap.h"
using namespace std;
const ll mod = 1e9+7;
const ll N = 2e5+5;
const int base = 313;
ll findGap(ll t, n)
{
    if(t == 1)
    {
        ll l = 0, r = 1e18, mn, mx, ans = 0;
        MinMax(l, r, &mn, &mx);
        while(l <= r)
        {
            MinMax(l+1, r-1, &mn, &mx);
            if(mn == -1)
            {
                ans = max(ans, r-l);
                break;
            }
            ans = max(ans, max(mn-l, r-mx));
            l = mn;
            r = mx;
            if(l == r)break;
        }
        return ans;
    }
    else
    {
        ll l = 0, r = 1e18, mn, mx, ans = 0;
        MinMax(l, r, &mn, &mx);
        l = mn+1;
        r = mx;
        ll lst = mn;
        ll len = (mx - mn) / (n - 1);
        ans = len;
        for(int i = l; i < r; i += len)
        {
            MinMax(i, i+len, &mn, &mx);
            if(mn == -1)continue;
            ans = max(ans, mn-lst);
            lst = mx;
        }
        return ans;
    }
}

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

gap.cpp:14:18: error: 'n' has not been declared
   14 | ll findGap(ll t, n)
      |                  ^
gap.cpp: In function 'long long int findGap(long long int, int)':
gap.cpp:42:31: error: 'n' was not declared in this scope; did you mean 'mn'?
   42 |         ll len = (mx - mn) / (n - 1);
      |                               ^
      |                               mn