# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
251928 | 2020-07-23T06:36:27 Z | kartel | Poklon (COCI17_poklon7) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define in(x) freopen(x, "r", stdin) #define out(x) freopen(x, "w", stdout) //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("Ofast,nso-stack-protector,unroll-loops,fast-math,-O3") #define F first #define S second #define pb push_back #define N +1000500 #define M ll(1e9 + 7) #define sz(x) (int)x.size() #define re return #define oo ll(1e9) #define el '\n' #define Max_A int(1e9) //#define el endl #define pii pair <int, int> #define psi pair <string, int> #define err ld(1e-9) #define Max_S int(3e6) #define last(x) x.back() #define all(x) (x).begin(), (x).end() #define arr_all(x, n) (x + 1), (x + 1 + n) using namespace std; //using namespace __gnu_pbds; //typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef long long ll; typedef long double ld; pair <pair <int, int>, pair <int, int> > f[N]; int i, n; psi umax(psi a, psi b) { if (sz(a.F) + a.S > sz(b.F) + b.S) return a; if (sz(a.F) + a.S < sz(b.F) + b.S) return b; string na = a.F, nb = b.F; while (sz(na) < sz(nb)) na += "0"; while (sz(na) > sz(nb)) nb += "0"; int i = 0; while (i < sz(na) && na[i] == nb[i]) i++; if (i == sz(na)) return a; if (na[i] > nb[i]) return a; else return b; } psi upd(psi x) { x.S++; return x; } string bin(ll x) { string ans = ""; while (x) { if (x & 1) ans += "1"; else ans += "0"; //ans += char('0' + x & 1); x >>= 1; } reverse(all(ans)); return ans; } psi rec(ll v) { psi lF; psi rF; if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; if (f[v].S > 0) rF = rec(f[v].S); else rF = {bin(-f[v].S), 0}; return upd(umax(lF, rF)); } string restore(psi x) { string ans = x.F; for (int i = 0; i < x.S; i++) ans += "0"; return ans; } int main() { cout.precision(2); srand(time(0)); ios_base::sync_with_stdio(0); iostream::sync_with_stdio(0); ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); // in("input.txt"); // out("output.txt"); cin >> n; for (i = 1; i <= n; i++) { int l, r; cin >> l >> r; f[i] = {l, r}; } cout << restore(rec(1)) << el; } // //00000 //00110 //00111 //00011 //00000
Compilation message
poklon.cpp: In function 'std::pair<std::__cxx11::basic_string<char>, int> rec(ll)': poklon.cpp:80:16: error: no match for 'operator>' (operand types are 'std::pair<int, int>' and 'int') if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ~~~~~~~^~~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:995:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&) operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) ^~~~~~~~ /usr/include/c++/7/bits/regex.h:995:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:1056:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&) operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1056:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:1136:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&) operator>(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1136:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:1210:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&) operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1210:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:1284:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*) operator>(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1284:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:1364:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&) operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1364:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from poklon.cpp:1: /usr/include/c++/7/bits/regex.h:1444:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&) operator>(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1444:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/future:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105, from poklon.cpp:1: /usr/include/c++/7/thread:293:3: note: candidate: bool std::operator>(std::thread::id, std::thread::id) operator>(thread::id __x, thread::id __y) noexcept ^~~~~~~~ /usr/include/c++/7/thread:293:3: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::thread::id' In file included from /usr/include/c++/7/forward_list:38:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:104, from poklon.cpp:1: /usr/include/c++/7/bits/forward_list.h:1406:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator>(const std::forward_list<_Tp, _Alloc>&, const std::forward_list<_Tp, _Alloc>&) operator>(const forward_list<_Tp, _Alloc>& __lx, ^~~~~~~~ /usr/include/c++/7/bits/forward_list.h:1406:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::forward_list<_Tp, _Alloc>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from poklon.cpp:1: /usr/include/c++/7/valarray:1187:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__greater, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__greater, _Tp>::result_type> std::operator>(const _Tp&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/valarray:1187:1: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: mismatched types 'const std::valarray<_Tp>' and 'int' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from poklon.cpp:1: /usr/include/c++/7/valarray:1187:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__greater, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__greater, _Tp>::result_type> std::operator>(const std::valarray<_Tp>&, const _Tp&) _DEFINE_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/valarray:1187:1: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from poklon.cpp:1: /usr/include/c++/7/valarray:1187:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__greater, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__greater, _Tp>::result_type> std::operator>(const std::valarray<_Tp>&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/valarray:1187:1: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from poklon.cpp:1: /usr/include/c++/7/bits/valarray_after.h:417:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__greater, typename _Dom1::value_type>::result_type> std::operator>(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/bits/valarray_after.h:417:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from poklon.cpp:1: /usr/include/c++/7/bits/valarray_after.h:417:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__greater, typename _Dom1::value_type>::result_type> std::operator>(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/bits/valarray_after.h:417:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from poklon.cpp:1: /usr/include/c++/7/bits/valarray_after.h:417:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__greater, typename _Dom1::value_type>::result_type> std::operator>(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/bits/valarray_after.h:417:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from poklon.cpp:1: /usr/include/c++/7/bits/valarray_after.h:417:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__greater, typename _Dom1::value_type>::result_type> std::operator>(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&) _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/bits/valarray_after.h:417:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from poklon.cpp:1: /usr/include/c++/7/bits/valarray_after.h:417:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__greater, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__greater, typename _Dom1::value_type>::result_type> std::operator>(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) ^ /usr/include/c++/7/bits/valarray_after.h:417:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/stack:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:89, from poklon.cpp:1: /usr/include/c++/7/bits/stl_stack.h:323:5: note: candidate: template<class _Tp, class _Seq> bool std::operator>(const std::stack<_Tp, _Seq>&, const std::stack<_Tp, _Seq>&) operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_stack.h:323:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::stack<_Tp, _Seq>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/set:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from poklon.cpp:1: /usr/include/c++/7/bits/stl_multiset.h:927:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator>(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&) operator>(const multiset<_Key,_Compare,_Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_multiset.h:927:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::multiset<_Key, _Compare, _Alloc>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/set:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from poklon.cpp:1: /usr/include/c++/7/bits/stl_set.h:944:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator>(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&) operator>(const set<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_set.h:944:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::set<_Key, _Compare, _Alloc>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from poklon.cpp:1: /usr/include/c++/7/bits/stl_queue.h:348:5: note: candidate: template<class _Tp, class _Seq> bool std::operator>(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&) operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:348:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::queue<_Tp, _Seq>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/vector:64:0, from /usr/include/c++/7/queue:61, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from poklon.cpp:1: /usr/include/c++/7/bits/stl_vector.h:1626:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator>(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:1626:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::vector<_Tp, _Alloc>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/memory:81:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from poklon.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:449:5: note: candidate: template<class _Tp> bool std::operator>(std::nullptr_t, const std::shared_ptr<_Tp>&) operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept ^~~~~~~~ /usr/include/c++/7/bits/shared_ptr.h:449:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: mismatched types 'const std::shared_ptr<_Tp>' and 'int' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/memory:81:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from poklon.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:444:5: note: candidate: template<class _Tp> bool std::operator>(const std::shared_ptr<_Tp>&, std::nullptr_t) operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept ^~~~~~~~ /usr/include/c++/7/bits/shared_ptr.h:444:5: note: template argument deduction/substitution failed: poklon.cpp:80:18: note: 'std::pair<int, int>' is not derived from 'const std::shared_ptr<_Tp>' if (f[v].S > 0) lF = rec(f[v].F); else lF = {bin(-f[v].F), 0}; ^ In file included from /usr/include/c++/7/memory:81:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82,