# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
412649 | 2021-05-27T09:23:37 Z | A_D | 낙하산 고리들 (IOI12_rings) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int n; const int N=1e6+100; vector<int> g[N]; int mx=0; int me[N]; freq[7][7]; void Init(int N_) { n = N_; } void Link(int a, int b){ if(mx>=5)return; g[a].push_back(b); g[b].push_back(a); mx=max(mx,g[a].size()); mx=max(mx,g[b].size()); me[g[a].size()]++; me[g[b].size()]++; for(auto x:g[a]){ freq[g[a].size()][g[x].size()]++; } for(auto x:g[b]){ freq[g[b].size()][g[x].size()]++; } } int CountCritical() { if(mx>=5)return 0; if(mx<=2)return n; if(mx==4){ if(me[4]>1)return 0; return freq[4][me[3]-1]; } else{ return freq[3][me[3]-1]; } }
Compilation message
rings.cpp:12:1: error: 'freq' does not name a type; did you mean 'free'? 12 | freq[7][7]; | ^~~~ | free rings.cpp: In function 'void Link(int, int)': rings.cpp:22:26: error: no matching function for call to 'max(int&, std::vector<int>::size_type)' 22 | mx=max(mx,g[a].size()); | ^ 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 rings.cpp:3: /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: rings.cpp:22:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'}) 22 | mx=max(mx,g[a].size()); | ^ 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 rings.cpp:3: /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: rings.cpp:22:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'}) 22 | mx=max(mx,g[a].size()); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from rings.cpp:3: /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: rings.cpp:22:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | mx=max(mx,g[a].size()); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from rings.cpp:3: /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: rings.cpp:22:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | mx=max(mx,g[a].size()); | ^ rings.cpp:23:26: error: no matching function for call to 'max(int&, std::vector<int>::size_type)' 23 | mx=max(mx,g[b].size()); | ^ 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 rings.cpp:3: /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: rings.cpp:23:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'}) 23 | mx=max(mx,g[b].size()); | ^ 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 rings.cpp:3: /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: rings.cpp:23:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'}) 23 | mx=max(mx,g[b].size()); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from rings.cpp:3: /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: rings.cpp:23:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 23 | mx=max(mx,g[b].size()); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from rings.cpp:3: /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: rings.cpp:23:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 23 | mx=max(mx,g[b].size()); | ^ rings.cpp:27:9: error: 'freq' was not declared in this scope; did you mean 'free'? 27 | freq[g[a].size()][g[x].size()]++; | ^~~~ | free rings.cpp:30:9: error: 'freq' was not declared in this scope; did you mean 'free'? 30 | freq[g[b].size()][g[x].size()]++; | ^~~~ | free rings.cpp: In function 'int CountCritical()': rings.cpp:39:16: error: 'freq' was not declared in this scope; did you mean 'free'? 39 | return freq[4][me[3]-1]; | ^~~~ | free rings.cpp:42:16: error: 'freq' was not declared in this scope; did you mean 'free'? 42 | return freq[3][me[3]-1]; | ^~~~ | free