# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
283111 | 2020-08-25T10:06:42 Z | aymanrs | Vision Program (IOI19_vision) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include <iostream> #include <set> #include <vector> std::set<std::pair<std::pair<int,int>, std::pair<int, int>>> alreadyTried; bool valid(int H, int W, int i, int j, int oI, oJ){ if(oI < i || (oI == i && oj < j)){ if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){ return false; } else { alreadyTried.insert({{oI, oJ}, {i, j}}); } } else { if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){ return false; } else { alreadyTried.insert({{i, j}, {oI, oJ}}); } } return && i >= 0 && i < H && j >= 0 && j < W; } void construct_network(int H, int W, int K){ int ind = H*W; for(int i = 0;i < H;i++){ for(int j = 0;j < W;j++){ for(int x = -K + 1; x < K;x++){ int y = K - abs(x); if(valid(H, W, i+y, j+x, i, j)){ add_and({i*W+j, (i+y)*H + (j+x)*W}); ind++; } y=-y; if(valid(H, W, i+y, j+x, i, j)){ add_and({i*W+j, (i+y)*H + (j+x)*W}); ind++; } } if(valid(H, W, i, j+K, i, j)){ add_and({i*W+j, i*H + (j+K)*W}); ind++; } if(valid(H, W, i, j-K, i, j)){ add_and({i*W+j, i*H + (j-K)*W}); ind++; } } } std::vector<int> vec; for(int i = H*W;i < ind;i++){ vec.push_back(i); } add_or(vec); }
Compilation message
vision.cpp:5:48: error: 'oJ' has not been declared 5 | bool valid(int H, int W, int i, int j, int oI, oJ){ | ^~ vision.cpp: In function 'bool valid(int, int, int, int, int, int)': vision.cpp:6:27: error: 'oj' was not declared in this scope; did you mean 'j'? 6 | if(oI < i || (oI == i && oj < j)){ | ^~ | j vision.cpp:7:30: error: 'oJ' was not declared in this scope; did you mean 'oI'? 7 | if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){ | ^~ | oI vision.cpp:7:42: error: no matching function for call to 'std::set<std::pair<std::pair<int, int>, std::pair<int, int> > >::find(<brace-enclosed initializer list>)' 7 | if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){ | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:794:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 794 | find(const key_type& __x) | ^~~~ /usr/include/c++/9/bits/stl_set.h:794:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'} 794 | find(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:798:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 798 | find(const key_type& __x) const | ^~~~ /usr/include/c++/9/bits/stl_set.h:798:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'} 798 | find(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:804:2: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::iterator{((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) [with _Kt = _Kt; _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]' 804 | find(const _Kt& __x) | ^~~~ /usr/include/c++/9/bits/stl_set.h:804:2: note: template argument deduction/substitution failed: vision.cpp:7:42: note: couldn't deduce template parameter '_Kt' 7 | if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){ | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:810:2: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::const_iterator{((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) const [with _Kt = _Kt; _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]' 810 | find(const _Kt& __x) const | ^~~~ /usr/include/c++/9/bits/stl_set.h:810:2: note: template argument deduction/substitution failed: vision.cpp:7:42: note: couldn't deduce template parameter '_Kt' 7 | if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){ | ^ vision.cpp:10:42: error: no matching function for call to 'std::set<std::pair<std::pair<int, int>, std::pair<int, int> > >::insert(<brace-enclosed initializer list>)' 10 | alreadyTried.insert({{oI, oJ}, {i, j}}); | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:509:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 509 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:509:32: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'} 509 | insert(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:518:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 518 | insert(value_type&& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:518:27: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::pair<std::pair<int, int>, std::pair<int, int> > >::value_type&&' {aka 'std::pair<std::pair<int, int>, std::pair<int, int> >&&'} 518 | insert(value_type&& __x) | ~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:546:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 546 | insert(const_iterator __position, const value_type& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:546:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/9/bits/stl_set.h:551:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 551 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:551:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/9/bits/stl_set.h:566:2: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]' 566 | insert(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:566:2: note: template argument deduction/substitution failed: vision.cpp:10:42: note: candidate expects 2 arguments, 1 provided 10 | alreadyTried.insert({{oI, oJ}, {i, j}}); | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:578:7: note: candidate: 'void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]' 578 | insert(initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:578:43: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<std::pair<std::pair<int, int>, std::pair<int, int> > >' 578 | insert(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ vision.cpp:13:38: error: 'oJ' was not declared in this scope; did you mean 'oI'? 13 | if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){ | ^~ | oI vision.cpp:13:42: error: no matching function for call to 'std::set<std::pair<std::pair<int, int>, std::pair<int, int> > >::find(<brace-enclosed initializer list>)' 13 | if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){ | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:794:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 794 | find(const key_type& __x) | ^~~~ /usr/include/c++/9/bits/stl_set.h:794:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'} 794 | find(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:798:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 798 | find(const key_type& __x) const | ^~~~ /usr/include/c++/9/bits/stl_set.h:798:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'} 798 | find(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:804:2: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::iterator{((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) [with _Kt = _Kt; _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]' 804 | find(const _Kt& __x) | ^~~~ /usr/include/c++/9/bits/stl_set.h:804:2: note: template argument deduction/substitution failed: vision.cpp:13:42: note: couldn't deduce template parameter '_Kt' 13 | if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){ | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:810:2: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::const_iterator{((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) const [with _Kt = _Kt; _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]' 810 | find(const _Kt& __x) const | ^~~~ /usr/include/c++/9/bits/stl_set.h:810:2: note: template argument deduction/substitution failed: vision.cpp:13:42: note: couldn't deduce template parameter '_Kt' 13 | if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){ | ^ vision.cpp:16:42: error: no matching function for call to 'std::set<std::pair<std::pair<int, int>, std::pair<int, int> > >::insert(<brace-enclosed initializer list>)' 16 | alreadyTried.insert({{i, j}, {oI, oJ}}); | ^ In file included from /usr/include/c++/9/set:61, from vision.cpp:2: /usr/include/c++/9/bits/stl_set.h:509:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 509 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:509:32: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'} 509 | insert(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:518:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 518 | insert(value_type&& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_set.h:518:27: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::pair<std::pair<int, int>, std::pair<int, int> > >::value_type&&' {aka 'std::pair<std::pair<int, int>, std::pair<int, int> >&&'} 518 | insert(value_type&& __x) | ~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_set.h:546:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::pair<std::pair<int, int>, std::pair<int, int> >; _Compare = std::less<std::pair<std::pair<int, int>, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<std::pair<int, int>, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]' 546 | insert(const_iterator __position, const value_type& __x) |