# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38747 | 2018-01-06T11:47:57 Z | Waschbar | Gap (APIO16_gap) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> #include "gap.h" using namespace std; const long long INF = 1e18; long long findGap(int T, int N) { multiset < pair< long long,pair<long long,long long> > > st; long long mn, mx; MinMax(0,INF,&mn,&mx); st.insert({-(mx-mx),{mn,mx}}); long long ans = 0; while(!st.empty()) { long long L, R; if(abs(st.begin()->first) <= ans) return ans; L = st.begin()->second.first; R = st.begin()->second.second; long long a1, a2, a3, a4; MinMax(L,(L+R)/2,&a1,&a2); MinMax((L+R)/2+1,R,&a3,&a4); if(a1 == a2 && a1 != -1) ans = max(ans,a2-L); if(a2-a1 == 1 && a1 != -1) ans = max(ans,1); if(a1-L == 1 && a1 != -1) ans = max(ans,1); if(a3 == a4 && a4 != -1) ans = max(ans,R-a3); if(a4-a3 == 1 && a3 != -1) ans = max(ans,1); if(R-a4 == 1 && a4 != -1) ans = max(ans,1); if(a2 != -1 && a3 != -1) ans = max(ans,a3-a2); if(a3 == -1 && a1 == -1) ans = max(ans,R-L); if(a1 == -1 && a3 != -1) ans = max(ans,a3-L); if(a3 == -1 && a2 != -1) ans = max(ans,R-a2); if(a1 != -1 && a1-L > 1) st.insert({L-a1,{L,a1}}); if(a1 != -1 && a2-a1 > 1) st.insert({a1-a2,{a1,a2}}); if(a1 != -1 && a3 != -1 && a3-a2 > 1) st.insert({a2-a3,{a2,a3}}); if(a3 != -1 && a4-a3 > 1) st.insert({a3-a4,{a3,a4}}); if(a3 != -1 && R-a4 > 1) st.insert({a4-R,{a4,R}}); } return ans; return 0; }
Compilation message
gap.cpp: In function 'long long int findGap(int, int)': gap.cpp:30:20: error: no matching function for call to 'max(long long int&, int)' ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: gap.cpp:30:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed: gap.cpp:30:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3457:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/5/bits/stl_algo.h:3457:5: note: template argument deduction/substitution failed: gap.cpp:30:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3463: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++/5/bits/stl_algo.h:3463:5: note: template argument deduction/substitution failed: gap.cpp:30:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ gap.cpp:32:20: error: no matching function for call to 'max(long long int&, int)' ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: gap.cpp:32:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed: gap.cpp:32:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3457:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/5/bits/stl_algo.h:3457:5: note: template argument deduction/substitution failed: gap.cpp:32:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3463: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++/5/bits/stl_algo.h:3463:5: note: template argument deduction/substitution failed: gap.cpp:32:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ gap.cpp:37:20: error: no matching function for call to 'max(long long int&, int)' ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: gap.cpp:37:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed: gap.cpp:37:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3457:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/5/bits/stl_algo.h:3457:5: note: template argument deduction/substitution failed: gap.cpp:37:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3463: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++/5/bits/stl_algo.h:3463:5: note: template argument deduction/substitution failed: gap.cpp:37:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ gap.cpp:39:20: error: no matching function for call to 'max(long long int&, int)' ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: gap.cpp:39:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from gap.cpp:1: /usr/include/c++/5/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++/5/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed: gap.cpp:39:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3457:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/5/bits/stl_algo.h:3457:5: note: template argument deduction/substitution failed: gap.cpp:39:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^ In file included from /usr/include/c++/5/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64, from gap.cpp:1: /usr/include/c++/5/bits/stl_algo.h:3463: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++/5/bits/stl_algo.h:3463:5: note: template argument deduction/substitution failed: gap.cpp:39:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans = max(ans,1); ^