# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
215946 | 2020-03-26T12:52:36 Z | SamAnd | Fire drill (LMIO18_sauga) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define m_p make_pair const int N = 1003; mt19937 rnd(132143134); int tt, n, ss; vector<int> a[N]; int u[N]; vector<int> v; bool c[N]; void dfs(int x) { c[x] = true; for (int i = 0; i < a[x].size(); ++i) { int h = a[x][i]; if (!c[h]) dfs(h); } v.push_back(x); } int ansq; vector<int> ans; int main() { scanf("%d%d%d", &tt, &n, &ss); for (int i = 1; i <= n; ++i) { int q; scanf("%d", &q); while (q--) { int x; scanf("%d", &x); a[i].push_back(x); } } for (int i = 1; i <= n; ++i) u[i] = i; while ((double)clock() / CLOCKS_PER_SEC < 0.8) { for (int i = n; i >= 1; --i) { swap(u[i], u[rnd() % i + 1]); } for (int i = 1; i <= n; ++i) { for (int j = (int)a[i].size() - 1; j >= 0; --j) { swap(a[i][j], a[rnd() % (j + 1)]); } } memset(c, false, sizeof c); v.clear(); for (int i = 1; i <= n; ++i) { int x = u[i]; if (!c[x]) dfs(x); } memset(c, false, sizeof c); int q = 0; for (int i = 0; i < n; ++i) { int x = v[i]; for (int j = 0; j < a[x].size(); ++j) { int h = a[x][j]; if (!c[h]) { ++q; break; } } c[x] = true; } if (ans.empty() || q < ansq) { ans = v; ansq = q; } } for (int i = 0; i < n; ++i) printf("%d\n", ans[i]); return 0; }
Compilation message
sauga.cpp: In function 'void dfs(int)': sauga.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < a[x].size(); ++i) ~~^~~~~~~~~~~~~ sauga.cpp: In function 'int main()': sauga.cpp:56:49: error: no matching function for call to 'swap(__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type&, std::vector<int>&)' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/complex:45:0, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from sauga.cpp:1: /usr/include/c++/7/sstream:796:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&) swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, ^~~~ /usr/include/c++/7/sstream:796:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/complex:45:0, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from sauga.cpp:1: /usr/include/c++/7/sstream:803:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&) swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, ^~~~ /usr/include/c++/7/sstream:803:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/complex:45:0, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from sauga.cpp:1: /usr/include/c++/7/sstream:810:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&) swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, ^~~~ /usr/include/c++/7/sstream:810:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/complex:45:0, from /usr/include/c++/7/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from sauga.cpp:1: /usr/include/c++/7/sstream:817:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&) swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, ^~~~ /usr/include/c++/7/sstream:817:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/regex.h:805:5: note: candidate: template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&) swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, ^~~~ /usr/include/c++/7/bits/regex.h:805:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/regex.h:1958:5: note: candidate: template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(std::__cxx11::match_results<_BiIter, _Alloc>&, std::__cxx11::match_results<_BiIter, _Alloc>&) swap(match_results<_Bi_iter, _Alloc>& __lhs, ^~~~ /usr/include/c++/7/bits/regex.h:1958:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:122:0, from sauga.cpp:1: /usr/include/c++/7/shared_mutex:676:5: note: candidate: template<class _Mutex> void std::swap(std::shared_lock<_Mutex>&, std::shared_lock<_Mutex>&) swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept ^~~~ /usr/include/c++/7/shared_mutex:676:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::shared_lock<_Mutex>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/unordered_set:48:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:118, from sauga.cpp:1: /usr/include/c++/7/bits/unordered_set.h:1528:5: note: candidate: template<class _Value, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&, std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&) swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, ^~~~ /usr/include/c++/7/bits/unordered_set.h:1528:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/unordered_set:48:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:118, from sauga.cpp:1: /usr/include/c++/7/bits/unordered_set.h:1521:5: note: candidate: template<class _Value, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_set<_Value, _Hash, _Pred, _Alloc>&, std::unordered_set<_Value, _Hash, _Pred, _Alloc>&) swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, ^~~~ /usr/include/c++/7/bits/unordered_set.h:1521:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105:0, from sauga.cpp:1: /usr/include/c++/7/future:1579:5: note: candidate: template<class _Res, class ... _ArgTypes> void std::swap(std::packaged_task<_Res(_ArgTypes ...)>&, std::packaged_task<_Res(_ArgTypes ...)>&) swap(packaged_task<_Res(_ArgTypes...)>& __x, ^~~~ /usr/include/c++/7/future:1579:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::packaged_task<_Res(_ArgTypes ...)>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105:0, from sauga.cpp:1: /usr/include/c++/7/future:1144:5: note: candidate: template<class _Res> void std::swap(std::promise<_Res>&, std::promise<_Res>&) swap(promise<_Res>& __x, promise<_Res>& __y) noexcept ^~~~ /usr/include/c++/7/future:1144:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::promise<_Res>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/thread:263:3: note: candidate: void std::swap(std::thread&, std::thread&) swap(thread& __x, thread& __y) noexcept ^~~~ /usr/include/c++/7/thread:263:3: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' to 'std::thread&' 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 sauga.cpp:1: /usr/include/c++/7/bits/forward_list.h:1427:5: note: candidate: template<class _Tp, class _Alloc> void std::swap(std::forward_list<_Tp, _Alloc>&, std::forward_list<_Tp, _Alloc>&) swap(forward_list<_Tp, _Alloc>& __lx, ^~~~ /usr/include/c++/7/bits/forward_list.h:1427:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::forward_list<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/condition_variable:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:103, from sauga.cpp:1: /usr/include/c++/7/bits/std_mutex.h:363:5: note: candidate: template<class _Mutex> void std::swap(std::unique_lock<_Mutex>&, std::unique_lock<_Mutex>&) swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept ^~~~ /usr/include/c++/7/bits/std_mutex.h:363:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::unique_lock<_Mutex>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/stl_stack.h:347:5: note: candidate: template<class _Tp, class _Seq> typename std::enable_if<std::__is_swappable<_T2>::value>::type std::swap(std::stack<_Tp, _Seq>&, std::stack<_Tp, _Seq>&) swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y) ^~~~ /usr/include/c++/7/bits/stl_stack.h:347:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::stack<_Tp, _Seq>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/stl_multiset.h:948:5: note: candidate: template<class _Key, class _Compare, class _Alloc> void std::swap(std::multiset<_Key, _Compare, _Alloc>&, std::multiset<_Key, _Compare, _Alloc>&) swap(multiset<_Key, _Compare, _Alloc>& __x, ^~~~ /usr/include/c++/7/bits/stl_multiset.h:948:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::multiset<_Key, _Compare, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/stl_set.h:965:5: note: candidate: template<class _Key, class _Compare, class _Alloc> void std::swap(std::set<_Key, _Compare, _Alloc>&, std::set<_Key, _Compare, _Alloc>&) swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) ^~~~ /usr/include/c++/7/bits/stl_set.h:965:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::set<_Key, _Compare, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/stl_queue.h:668:5: note: candidate: template<class _Tp, class _Sequence, class _Compare> typename std::enable_if<std::__and_<std::__is_swappable<_T2>, std::__is_swappable<_Compare> >::value>::type std::swap(std::priority_queue<_Tp, _Sequence, _Compare>&, std::priority_queue<_Tp, _Sequence, _Compare>&) swap(priority_queue<_Tp, _Sequence, _Compare>& __x, ^~~~ /usr/include/c++/7/bits/stl_queue.h:668:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::priority_queue<_Tp, _Sequence, _Compare>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/stl_queue.h:372:5: note: candidate: template<class _Tp, class _Seq> typename std::enable_if<std::__is_swappable<_T2>::value>::type std::swap(std::queue<_Tp, _Seq>&, std::queue<_Tp, _Seq>&) swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) ^~~~ /usr/include/c++/7/bits/stl_queue.h:372:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::queue<_Tp, _Seq>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:595:5: note: candidate: template<class _Tp> void std::swap(std::weak_ptr<_Tp>&, std::weak_ptr<_Tp>&) swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept ^~~~ /usr/include/c++/7/bits/shared_ptr.h:595:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::weak_ptr<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ 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 sauga.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:474:5: note: candidate: template<class _Tp> void std::swap(std::shared_ptr<_Tp>&, std::shared_ptr<_Tp>&) swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept ^~~~ /usr/include/c++/7/bits/shared_ptr.h:474:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::shared_ptr<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/bits/shared_ptr.h:52:0, from /usr/include/c++/7/memory:81, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from sauga.cpp:1: /usr/include/c++/7/bits/shared_ptr_base.h:1741:5: note: candidate: template<class _Tp, __gnu_cxx::_Lock_policy _Lp> void std::swap(std::__weak_ptr<_Tp, _Lp>&, std::__weak_ptr<_Tp, _Lp>&) swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept ^~~~ /usr/include/c++/7/bits/shared_ptr_base.h:1741:5: note: template argument deduction/substitution failed: sauga.cpp:56:49: note: mismatched types 'std::__weak_ptr<_Tp, _Lp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' swap(a[i][j], a[rnd() % (j + 1)]); ^ In file included from /usr/include/c++/7/bits/shared_ptr.h:52:0, from /usr/include/c++/7/memory:81, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from sauga.cpp:1: /usr/include/c++/7/bits/shared_ptr_base.h:1533:5: note: candidate: template<class _Tp, __gnu_cxx::_Lock_policy _Lp> void std::swap(std::__shared_ptr<_Tp, _Lp>&, std::__shared_ptr<_Tp, _Lp>&) swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) noexcept ^~~~ /usr/include/c++/7/bits/shared_ptr_base.h:1533:5: note: