# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
208132 | YJU | 구경하기 (JOI13_watching) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=2e3+5;
const ld pi=3.14159265359;
const ll INF=(1LL<<62);
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()
ll n,P,Q,x,DP[N][N];
vector<ll> v;
bool b(ll k){
memset(DP,0,sizeof(DP));
REP(i,P+1)REP(j,Q+1){
DP[i][j+1]=max(DP[i][j+1],lwb(v.begin(),v.end(),v[DP[i][j]]+2*k)-v.begin());
DP[i+1][j]=max(DP[i+1][j],lwb(v.begin(),v.end(),v[DP[i][j]]+1*k)-v.begin());
if(DP[i][j]==n)return 1;
}
return 0;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>n>>P>>Q;
P=min(P,n);Q=min(Q,n);
REP(i,n)cin>>x,v.pb(x);
sort(v.begin(),v.end());
ll l=-1,r=MOD;
while(r-l>1){
(b((r+l)/2)?r=(r+l)/2:l=(r+l)/2);
}
cout<<r<<"\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
watching.cpp: In function 'bool b(ll)': watching.cpp:26:77: error: no matching function for call to 'max(ll&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)' DP[i][j+1]=max(DP[i][j+1],lwb(v.begin(),v.end(),v[DP[i][j]]+2*k)-v.begin()); ^ In file included from /usr/include/c++/7/bits/specfun.h:45:0, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from watching.cpp:1: /usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/7/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: watching.cpp:26:77: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type {aka long int}') DP[i][j+1]=max(DP[i][j+1],lwb(v.begin(),v.end(),v[DP[i][j]]+2*k)-v.begin()); ^ In file included from /usr/include/c++/7/bits/specfun.h:45:0, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from watching.cpp:1: /usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/7/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed: watching.cpp:26:77: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type {aka long int}') DP[i][j+1]=max(DP[i][j+1],lwb(v.begin(),v.end(),v[DP[i][j]]+2*k)-v.begin()); ^ In file included from /usr/include/c++/7/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from watching.cpp:1: /usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^~~ /usr/include/c++/7/bits/stl_algo.h:3462:5: note: template argument deduction/substitution failed: watching.cpp:26:77: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' DP[i][j+1]=max(DP[i][j+1],lwb(v.begin(),v.end(),v[DP[i][j]]+2*k)-v.begin()); ^ In file included from /usr/include/c++/7/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from watching.cpp:1: /usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/7/bits/stl_algo.h:3468:5: note: template argument deduction/substitution failed: watching.cpp:26:77: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' DP[i][j+1]=max(DP[i][j+1],lwb(v.begin(),v.end(),v[DP[i][j]]+2*k)-v.begin()); ^ watching.cpp:27:77: error: no matching function for call to 'max(ll&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)' DP[i+1][j]=max(DP[i+1][j],lwb(v.begin(),v.end(),v[DP[i][j]]+1*k)-v.begin()); ^ In file included from /usr/include/c++/7/bits/specfun.h:45:0, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from watching.cpp:1: /usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/7/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: watching.cpp:27:77: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type {aka long int}') DP[i+1][j]=max(DP[i+1][j],lwb(v.begin(),v.end(),v[DP[i][j]]+1*k)-v.begin()); ^ In file included from /usr/include/c++/7/bits/specfun.h:45:0, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from watching.cpp:1: /usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/7/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed: watching.cpp:27:77: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type {aka long int}') DP[i+1][j]=max(DP[i+1][j],lwb(v.begin(),v.end(),v[DP[i][j]]+1*k)-v.begin()); ^ In file included from /usr/include/c++/7/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from watching.cpp:1: /usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^~~ /usr/include/c++/7/bits/stl_algo.h:3462:5: note: template argument deduction/substitution failed: watching.cpp:27:77: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' DP[i+1][j]=max(DP[i+1][j],lwb(v.begin(),v.end(),v[DP[i][j]]+1*k)-v.begin()); ^ In file included from /usr/include/c++/7/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from watching.cpp:1: /usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/7/bits/stl_algo.h:3468:5: note: template argument deduction/substitution failed: watching.cpp:27:77: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' DP[i+1][j]=max(DP[i+1][j],lwb(v.begin(),v.end(),v[DP[i][j]]+1*k)-v.begin()); ^