제출 #1341080

#제출 시각아이디문제언어결과실행 시간메모리
1341080aritro_Gap (APIO16_gap)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;

typedef long long ll;
#define pb push_back

ll MinMax(int s,int t,int a,int b);

ll findGap(int t,int n){
    if(t==1){
        ll l=-1,r=2e18;
        vector<ll> a;
        for(int i=0;i<(n+1)/2;i++){
            MinMax(l+1,r-1,&l,&r);
            a.pb(l);
            if(l!=r) a.pb(r);
        }
        sort(a.begin(),a.end());
        ll ans=0;
        for(int i=0;i<n-1;i++) ans=max(ans,a[i+1]-a[i]);
        return ans;
    }else if(t==2){
        ll ans=1;
        ll st,end;
        MinMax(1,1e18,&st,&end);
        if(T==2){
            ll len=end-st;
            ll gap=(len+N-2)/(N-1);
            ans=max(gap, ans);
            vector<ll> arr={st};
            ll fir=st+1,sec=st+1+gap;
            ll o,t;
            while(fir<=end){
                MinMax(fir,sec,&o,&t);
                if(o!=-1) arr.pb(o);
                if(t!=-1) arr.pb(t);
                fir+=gap+1,sec+=gap+1;
            }
            for(int i=1;i<arr.size();i++) ans=max(ans,arr[i]-arr[i-1]);
            return ans;
        }
    }
}

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:27:12: error: 'T' was not declared in this scope
   27 |         if(T==2){
      |            ^
gap.cpp:29:25: error: 'N' was not declared in this scope
   29 |             ll gap=(len+N-2)/(N-1);
      |                         ^
gap.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^