제출 #501366

#제출 시각아이디문제언어결과실행 시간메모리
501366kevinxiehkGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
long long findGap(int T, int n) {
    // TODO: implementation
    if(T == 1) {
        long long arr[n + 5];
        for(int i = 0; i < (n + 1) / 2; i++) {
            if(i == 0) MinMax(0, 1000000000000000000LL, &arr[0], &arr[n - 1]);
            else MinMax(arr[i - 1] + 1, arr[n - i] - 1, &arr[i], &arr[n - i - 1]); 
        }
        long long ans = 0;
        for(int i = 0; i < n - 1; i++) ans = max(ans, arr[i + 1] - arr[i]);
        return ans;
    }
    else {
        long long l, r;
        MinMax(0, 1000000000000000000LL, &l, &r);
        long long chunk = (r - l + n - 2) / (n - 1);
        long long a, b, c = l;
        l++;
        long long ans = 0;
        while(l < r) {
            MinMax(l, l + chunk - 1, &a, &b);
            l += chunk;
            if(a == -1) continue;
            ans = max(ans, a - c);
            c = b;
        }
        ans = max(ans, r - c);
        return ans;
    }
}

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:6:24: error: 'MinMax' was not declared in this scope
    6 |             if(i == 0) MinMax(0, 1000000000000000000LL, &arr[0], &arr[n - 1]);
      |                        ^~~~~~
gap.cpp:7:18: error: 'MinMax' was not declared in this scope
    7 |             else MinMax(arr[i - 1] + 1, arr[n - i] - 1, &arr[i], &arr[n - i - 1]);
      |                  ^~~~~~
gap.cpp:10:46: error: 'max' was not declared in this scope
   10 |         for(int i = 0; i < n - 1; i++) ans = max(ans, arr[i + 1] - arr[i]);
      |                                              ^~~
gap.cpp:15:9: error: 'MinMax' was not declared in this scope
   15 |         MinMax(0, 1000000000000000000LL, &l, &r);
      |         ^~~~~~
gap.cpp:24:19: error: 'max' was not declared in this scope
   24 |             ans = max(ans, a - c);
      |                   ^~~
gap.cpp:27:15: error: 'max' was not declared in this scope
   27 |         ans = max(ans, r - c);
      |               ^~~