답안 #1076749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1076749 2024-08-26T16:09:00 Z TFF Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
long long findGap(int t, int n) {
    long long mn, mx, left, right;
    left = 0;
    right = 1000000000000000000;
    mn = mx = 0;
    vector<long long> arr1, arr2;
    for (int i = 0; i < (n + 1) / 2; i++) {
        MinMax(left, right, &mn, &mx);
        arr1.push_back(mn);
        arr2.push_back(mx);
        left = mn + 1;
        right = mx - 1;
    }
    long long ans = arr2.back() - arr1.back();
    for (int i = 0; i < (int)arr1.size() - 1; i++) {
        ans = max(ans, arr1[i + 1] - arr1[i]);
    }
    for (int i = (int)arr2.size() - 2; i >= 0; i--) {
        ans = max(ans, arr2[i + 1] - arr2[i]);
    }
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:9: error: 'MinMax' was not declared in this scope
   10 |         MinMax(left, right, &mn, &mx);
      |         ^~~~~~