답안 #1083352

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1083352 2024-09-03T02:38:58 Z Seungni Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;

ll ans[100005];

long long findGap(int T, int N) {
    
    ll l = 0, r = 2e18;
    int lidx = 0, ridx = N - 1;
    
    ll mn, mx;
    for (int i = 0; i < (N + 1) / 2; i++) {
        MinMax(l, r, mn, mx);
        ans[lidx++] = mn, ans[ridx--] = mx;
        l = mn + 1, r = mx - 1;
    }
    
    ll ret = 0;
    for (int i = 1; i < N; i++) ret = max(ret, ans[i] - ans[i - 1]);
    
    return ret;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:16:22: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   16 |         MinMax(l, r, 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:16:26: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   16 |         MinMax(l, r, 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*);
      |                                               ^~~~~~~~~~