제출 #671087

#제출 시각아이디문제언어결과실행 시간메모리
671087AdamGSGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18;
ll findGap(int t, int n) {
        ll mi, ma;
        MinMax(0, INF, &mi, &ma);
        ll x=(*ma-*mi+n-1)/(n-1), ans=x;
        ll lst=mi;
        for(ll i=mi; i<ma; i+=x+1) {
                ll a, b;
                MinMax(i, i+x, &a, &b);
                if(a==-1) continue;
                ans=max(ans, a-lst);
                lst=b;
        }
        return ans;
}

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:9:15: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
    9 |         ll x=(*ma-*mi+n-1)/(n-1), ans=x;
      |               ^~~
gap.cpp:9:19: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
    9 |         ll x=(*ma-*mi+n-1)/(n-1), ans=x;
      |                   ^~~
gap.cpp:15:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |                 ans=max(ans, a-lst);
      |                 ^~~
      |                 abs
gap.cpp:18:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |         return ans;
      |                ^~~
      |                abs