답안 #1015114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015114 2024-07-06T06:17:01 Z vjudge1 Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;

ll findGap(int T, int N){
    if (T == 1){
        vector<ll> vec;
        while (N > 0){
            N -= 2;

            ll mn = 0, mx = 1e18;
            MinMax(mn, mx, mn, mx);

            vec.push_back(mn);
            vec.push_back(mx);
            
            mn++;
            mx--;
        }

        sort(vec.begin(), vec.end());
        
        ll res = 0;
        for (int i = 1; i < N; i ++)
            res = max(res, a[i] - a[i - 1]);
        return res;
    }
    return 0;
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:15:28: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   15 |             MinMax(mn, mx, mn, mx);
      |                            ^~
      |                            |
      |                            ll {aka long long int}
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:15:32: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   15 |             MinMax(mn, mx, mn, mx);
      |                                ^~
      |                                |
      |                                ll {aka long long int}
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:28:28: error: 'a' was not declared in this scope
   28 |             res = max(res, a[i] - a[i - 1]);
      |                            ^