제출 #162965

#제출 시각아이디문제언어결과실행 시간메모리
162965HungAnhGoldIBO2020Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const long long inf=1e18; long long findGap(int T,long int N){ if(T==2){ long long min1,max1; MinMax(0,inf,min1,max1); long long num=max1-min1-1; assert(num>=N-2); long long val=num/(N-1),cnt=num%(N-1); long long ans=val,now=min1+1,now1,dum,dum1; vector<long long> ans_lis; ans_lis.push_back(min1); for(int i=1;i<N;i++){ now1=now+val-1; if(cnt){ cnt--; now1++; } if(now<=now1){ MinMax(now,now1,dum,dum1); now=now1+1; ans_lis.push_back(dum); ans_lis.push_back(dum1); } } ans_lis.push_back(max1); for(int i=0;i<ans_lis.size()-1;i++){ ans=max(ans,ans_lis[i+1]-ans_lis[i]); } return ans; } else{ long long min1=-1,max1=inf+1,ans=0; vector<long long> ans_lis,ans_lis1; for(i=1;i<=(N+1)/2;i++){ assert(min1+1<=max1-1); MinMax(min1+1,max1-1,min1,max1); ans_lis.push_back(min1); ans_lis1.push_back(max1); } while(ans_lis1.size()){ ans_lis.push_back(ans_lis1.back()); ans_lis1.pop_back(); } for(int i=0;i+1<ans_lis.size();i++){ ans=max(ans,ans_lis[i+1]-ans_lis[i]); } return ans; } }

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

gap.cpp: In function 'long long int findGap(int, long int)':
gap.cpp:7:3: error: 'MinMax' was not declared in this scope
   MinMax(0,inf,min1,max1);
   ^~~~~~
gap.cpp:7:3: note: suggested alternative: 'rindex'
   MinMax(0,inf,min1,max1);
   ^~~~~~
   rindex
gap.cpp:28:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<ans_lis.size()-1;i++){
               ~^~~~~~~~~~~~~~~~~
gap.cpp:36:7: error: 'i' was not declared in this scope
   for(i=1;i<=(N+1)/2;i++){
       ^
gap.cpp:38:4: error: 'MinMax' was not declared in this scope
    MinMax(min1+1,max1-1,min1,max1);
    ^~~~~~
gap.cpp:38:4: note: suggested alternative: 'rindex'
    MinMax(min1+1,max1-1,min1,max1);
    ^~~~~~
    rindex
gap.cpp:46:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i+1<ans_lis.size();i++){
               ~~~^~~~~~~~~~~~~~~