# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51333 | 2018-06-17T13:44:36 Z | Milki | KOVANICE (COI15_kovanice) | C++14 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define TRACE(x) cerr << #x << " = " << x << endl #define _ << " " << typedef long long ll; typedef pair<int, int> point; const int MAXN = 3e5 + 5; int n, m, v; vector <int> lvl[MAXN], up[MAXN], down[MAXN]; vector <point> E; int upVal[MAXN], downVal[MAXN]; int id[MAXN]; bool bio[MAXN]; void spoji(int x, int curr){ bio[x] = true; id[x] = curr; for(auto it : lvl[x]) if(!bio[it]) spoji(it, curr); } int dfs1(int x){ if(upVal[x]) return upVal[x]; for(auto it : up[x]) upVal[x] = max(upVal[x], dfs1(it)); upVal[x] ++; return upVal[x]; } int dfs2(int x){ if(downVal[x]) return downVal[x]; for(auto it : down[x]) downVal[x] = max(downVal[x], dfs2(it)); downVal[x] ++; return downVal[x]; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m >> v; REP(i, v){ int a, b; char c; cin >> a >> c >> b; if(c == '<'){ E.push_back(point(a, b)); } else{ lvl[a].push_back(b); lvl[b].push_back(a); } } int tijme = 0; FOR(i, 1, n + 1) if(!bio[i]) spoji(i, tijme++); FOR(i, 1, n + 1){ up[id[E.first]].push_back(id[E.second]); down[id[E.second]].push_back(id[E.first]); } FOR(i, 1, n + 1){ dfs1(id[i]); dfs2(id[i]); } FOR(i, 1, n + 1){ if(up[id[i]] + down[id[i]] == n + 1) cout << 'K' << up[id[i]] << "\n"; else cout << "?\n"; } }
Compilation message
kovanice.cpp: In function 'int main()': kovanice.cpp:71:17: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' up[id[E.first]].push_back(id[E.second]); ^~~~~ kovanice.cpp:71:40: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'; did you mean 'cend'? up[id[E.first]].push_back(id[E.second]); ^~~~~~ cend kovanice.cpp:72:19: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'; did you mean 'cend'? down[id[E.second]].push_back(id[E.first]); ^~~~~~ cend kovanice.cpp:72:43: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' down[id[E.second]].push_back(id[E.first]); ^~~~~ kovanice.cpp:81:22: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'std::vector<int>') if(up[id[i]] + down[id[i]] == n + 1) ~~~~~~~~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/char_traits.h:39, from /usr/include/c++/7/ios:40, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/stl_iterator.h:397:5: note: candidate: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&) operator+(typename reverse_iterator<_Iterator>::difference_type __n, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:397:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/char_traits.h:39, from /usr/include/c++/7/ios:40, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/stl_iterator.h:1198:5: note: candidate: template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&) operator+(typename move_iterator<_Iterator>::difference_type __n, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1198:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5876:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5876:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:53:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.tcc:1157:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(const _CharT* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.tcc:1157:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: mismatched types 'const _CharT*' and 'std::vector<int>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:53:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.tcc:1173:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) ^~~~~~~~ /usr/include/c++/7/bits/basic_string.tcc:1173:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5913:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5913:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5929:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5929:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5941:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5941:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5947:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5947:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5953:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5953:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5965:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(const _CharT* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5965:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: mismatched types 'const _CharT*' and 'std::vector<int>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5971:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(_CharT __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5971:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5977:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5977:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from /usr/include/c++/7/complex:45, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/bits/basic_string.h:5983:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5983:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/ccomplex:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/complex:326:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&) operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) ^~~~~~~~ /usr/include/c++/7/complex:326:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' if(up[id[i]] + down[id[i]] == n + 1) ^ In file included from /usr/include/c++/7/ccomplex:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from kovanice.cpp:1: /usr/include/c++/7/complex:335:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&) operator+(const complex<_Tp>& __x, const _Tp& __y) ^~~~~~~~ /usr/include/c++/7/complex:335:5: note: template argument deduction/substitution failed: kovanice.cpp:81:34: note: 'std::vector<int>' is not derived from 'const std::comple