제출 #1198296

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

//#define int long long
#define OYY LLONG_MAX
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fi first
#define se second
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define pb push_back
#define lim 200005

typedef long long lo;

//~ inline void MinMax(lo xx,lo yy,lo &x,lo &y){
	//~ cout<<xx<<" "<<yy<<endl;
	//~ lo a,b;cin>>a>>b;
	//~ x=a,y=b;
}

long long findGap(int T, int N){
	int r=N;
	lo cur_l=0,cur_r=OYY;
	lo dizi[N+1];
	for(int l=1;l<=N;l++){
		lo mn,mx;
		MinMax(cur_l,cur_r,&mn,&mx);
		if(l>r)break;
		dizi[l++]=mn;
		dizi[r--]=mx;
		cur_l=mn;
		cur_r=mx;
	}
	
	int cev=0;
	
	for(int i=2;i<=N;i++){
		cev=max(cev,dizi[i]-dizi[i-1]);
	}
	return cev;
}

//~ int main(){
	//~ faster
	//~ int t,n;cin>>t>>n;
	//~ cout<<findGap(t,n)<<'\n';
	//~ return 0;
//~ }

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

gap.cpp:21:1: error: expected declaration before '}' token
   21 | }
      | ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:40:24: error: no matching function for call to 'max(int&, lo)'
   40 |                 cev=max(cev,dizi[i]-dizi[i-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
gap.cpp:40:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'lo' {aka 'long long int'})
   40 |                 cev=max(cev,dizi[i]-dizi[i-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
gap.cpp:40:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'lo' {aka 'long long int'})
   40 |                 cev=max(cev,dizi[i]-dizi[i-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
gap.cpp:40:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   40 |                 cev=max(cev,dizi[i]-dizi[i-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
gap.cpp:40:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   40 |                 cev=max(cev,dizi[i]-dizi[i-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~