# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896834 | 2024-01-02T09:22:45 Z | ace5 | Just Long Neckties (JOI20_ho_t1) | C++17 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define int int64_t signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int ans[n+1]; int ind[n+2]; int a[n+2],b[n+1]; multiset<int> c; for(int i = 0;i < n+1;++i) { cin >> a[i]; ind[i] = i; } sort(ind,ind + n + 1,[&](int x,int y){return a[x] < a[y];}); for(int i = 0;i < n;++i) cin >> b[i]; sort(b,b+n); for(int i = 0;i < n;++i) { c.insert(-max(0ll,a[ind[i+1]] - b[i])); } for(int i =0;i < n+1;++i) { ans[ind[i]] = -(*c.begin()); c.erase(c.find(-max(0ll,a[ind[i+1]] - b[i]))); c.insert(-max(0ll,a[ind[i]] - b[i])); } for(auto c:ans) cout << c << ' '; return 0; }
Compilation message
ho_t1.cpp: In function 'int main()': ho_t1.cpp:28:45: error: no matching function for call to 'max(long long int, int64_t)' 28 | c.insert(-max(0ll,a[ind[i+1]] - b[i])); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, 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:28:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 28 | c.insert(-max(0ll,a[ind[i+1]] - b[i])); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, 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:28:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 28 | c.insert(-max(0ll,a[ind[i+1]] - b[i])); | ^ 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:28:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | c.insert(-max(0ll,a[ind[i+1]] - b[i])); | ^ 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:28:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | c.insert(-max(0ll,a[ind[i+1]] - b[i])); | ^ ho_t1.cpp:33:51: error: no matching function for call to 'max(long long int, int64_t)' 33 | c.erase(c.find(-max(0ll,a[ind[i+1]] - b[i]))); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, 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:33:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 33 | c.erase(c.find(-max(0ll,a[ind[i+1]] - b[i]))); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, 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:33:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 33 | c.erase(c.find(-max(0ll,a[ind[i+1]] - b[i]))); | ^ 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:33:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | c.erase(c.find(-max(0ll,a[ind[i+1]] - b[i]))); | ^ 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:33:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | c.erase(c.find(-max(0ll,a[ind[i+1]] - b[i]))); | ^ ho_t1.cpp:34:43: error: no matching function for call to 'max(long long int, int64_t)' 34 | c.insert(-max(0ll,a[ind[i]] - b[i])); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, 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:34:43: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 34 | c.insert(-max(0ll,a[ind[i]] - b[i])); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, 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:34:43: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 34 | c.insert(-max(0ll,a[ind[i]] - b[i])); | ^ 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:34:43: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | c.insert(-max(0ll,a[ind[i]] - b[i])); | ^ 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:34:43: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | c.insert(-max(0ll,a[ind[i]] - b[i])); | ^