# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745738 | owoovo | Just Long Neckties (JOI20_ho_t1) | C++14 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
pair<ll,ll> a[200010]={};
ll pref[200010]={},preb[200010]={},b[200010]={},ans[200010]={};
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
for(int i=1;i<=n+1;i++){
cin>>a[i].first;
a[i].second=i;
}
for(int i=1;i<=n;i++){
cin>>b[i];
}
sort(&a[1],&a[n+2]);
sort(&b[1],&b[n+1]);
for(int i=1;i<=n;i++){
pref[i]=max(pref[i-1],max(a[i].first-b[i],0));
}
for(int i=1;i<=n;i++){
preb[i]=max(preb[i-1],max(a[n+2-i].first-b[n+1-i],0));
}
for(int i=0;i<=n;i++){
ans[a[i+1].second]=max(preb[n-i],pref[i]);
}
for(int i=1;i<=n+1;i++){
cout<<ans[i]<<" ";
}
return 0;
}
Compilation message (stderr)
ho_t1.cpp: In function 'int main()': ho_t1.cpp:21:52: error: no matching function for call to 'max(long long int, int)' 21 | pref[i]=max(pref[i-1],max(a[i].first-b[i],0)); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from ho_t1.cpp:1: /usr/include/c++/10/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++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: ho_t1.cpp:21:52: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 21 | pref[i]=max(pref[i-1],max(a[i].first-b[i],0)); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from ho_t1.cpp:1: /usr/include/c++/10/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++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: ho_t1.cpp:21:52: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 21 | pref[i]=max(pref[i-1],max(a[i].first-b[i],0)); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from ho_t1.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: ho_t1.cpp:21:52: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | pref[i]=max(pref[i-1],max(a[i].first-b[i],0)); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from ho_t1.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: ho_t1.cpp:21:52: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | pref[i]=max(pref[i-1],max(a[i].first-b[i],0)); | ^ ho_t1.cpp:24:60: error: no matching function for call to 'max(long long int, int)' 24 | preb[i]=max(preb[i-1],max(a[n+2-i].first-b[n+1-i],0)); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from ho_t1.cpp:1: /usr/include/c++/10/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++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: ho_t1.cpp:24:60: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 24 | preb[i]=max(preb[i-1],max(a[n+2-i].first-b[n+1-i],0)); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from ho_t1.cpp:1: /usr/include/c++/10/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++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: ho_t1.cpp:24:60: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 24 | preb[i]=max(preb[i-1],max(a[n+2-i].first-b[n+1-i],0)); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from ho_t1.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: ho_t1.cpp:24:60: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 24 | preb[i]=max(preb[i-1],max(a[n+2-i].first-b[n+1-i],0)); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from ho_t1.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: ho_t1.cpp:24:60: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 24 | preb[i]=max(preb[i-1],max(a[n+2-i].first-b[n+1-i],0)); | ^