# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
130625 | 2019-07-15T18:44:32 Z | tutis | Amusement Park (JOI17_amusement_park) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include "Joi.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; void Joi(int N, int M, int A[], int B[], long long X, int T) { vector<int>P(N); iota(P.begin(), P.end(), 0); shuffle(P.begin(), P.end(), mt19937_64(15651)); int bitas[N]; int t = 0; for (int i : P) { bitas[i] = t; t = (t + 1) % 60; } for (int i = 0; i < N; i++) { int s = 0; if ((X & (1ll << bitas[i])) > 0) s = 1; MessageBoard(i, s); } }
#include "Ioi.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; mt19937_64 rng(1561561); long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) { vector<int>P(N); iota(P.begin(), P.end(), 0); shuffle(P.begin(), P.end(), mt19937_64(15651)); int bitas[N]; int t = 0; for (int i : P) { bitas[i] = t; t = (t + 1) % 60; } vector<int>adj[N]; for (int i = 0; i < M; i++) { adj[A[i]].push_back(B[i]); adj[B[i]].push_back(A[i]); } for (int i = 0; i < N; i++) { shuffle(adj[i].begin(), adj[i].end(), rng); } set<int>aplankyti; set<int>bitai; ll X = 0; while (true) { X |= V * (1ll << bitas[P]); bitai.insert(bitas[P]); aplankyti.insert(P); if (bitai.size() == 60) break; shuffle(adj[P].begin(), adj[P].end(), rng); int v1 = adj[P][0]; V = move(v1); P = v1; } return X; }
Compilation message
Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)': Ioi.cpp:8:16: error: declaration of 'std::vector<int> P' shadows a parameter vector<int>P(N); ^ Ioi.cpp:33:25: error: no match for 'operator[]' (operand types are 'int [N]' and 'std::vector<int>') X |= V * (1ll << bitas[P]); ^ Ioi.cpp:34:21: error: no match for 'operator[]' (operand types are 'int [N]' and 'std::vector<int>') bitai.insert(bitas[P]); ^ Ioi.cpp:35:21: error: no matching function for call to 'std::set<int>::insert(std::vector<int>&)' aplankyti.insert(P); ^ 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 Ioi.cpp:2: /usr/include/c++/7/bits/stl_set.h:499:7: note: candidate: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::value_type = int] insert(const value_type& __x) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:499:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'const value_type& {aka const int&}' /usr/include/c++/7/bits/stl_set.h:508:7: note: candidate: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::value_type = int] insert(value_type&& __x) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:508:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::set<int>::value_type&& {aka int&&}' /usr/include/c++/7/bits/stl_set.h:536: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::value_type = int] insert(const_iterator __position, const value_type& __x) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:536:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/7/bits/stl_set.h:541: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::value_type = int] insert(const_iterator __position, value_type&& __x) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:541:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/7/bits/stl_set.h:556:2: note: candidate: template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] insert(_InputIterator __first, _InputIterator __last) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:556:2: note: template argument deduction/substitution failed: Ioi.cpp:35:21: note: candidate expects 2 arguments, 1 provided aplankyti.insert(P); ^ 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 Ioi.cpp:2: /usr/include/c++/7/bits/stl_set.h:568:7: note: candidate: void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] insert(initializer_list<value_type> __l) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:568:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<int>' /usr/include/c++/7/bits/stl_set.h:588:7: note: candidate: std::set<_Key, _Compare, _Alloc>::insert_return_type std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::node_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::insert_return_type = std::_Node_insert_return<std::_Rb_tree_const_iterator<int>, std::_Node_handle<int, int, std::allocator<std::_Rb_tree_node<int> > > >; std::set<_Key, _Compare, _Alloc>::node_type = std::_Node_handle<int, int, std::allocator<std::_Rb_tree_node<int> > >] insert(node_type&& __nh) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:588:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::set<int>::node_type&& {aka std::_Node_handle<int, int, std::allocator<std::_Rb_tree_node<int> > >&&}' /usr/include/c++/7/bits/stl_set.h:593: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>::node_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::set<_Key, _Compare, _Alloc>::node_type = std::_Node_handle<int, int, std::allocator<std::_Rb_tree_node<int> > >] insert(const_iterator __hint, node_type&& __nh) ^~~~~~ /usr/include/c++/7/bits/stl_set.h:593:7: note: candidate expects 2 arguments, 1 provided Ioi.cpp:38:14: error: no match for 'operator[]' (operand types are 'std::vector<int> [N]' and 'std::vector<int>') shuffle(adj[P].begin(), adj[P].end(), rng); ^ Ioi.cpp:38:30: error: no match for 'operator[]' (operand types are 'std::vector<int> [N]' and 'std::vector<int>') shuffle(adj[P].begin(), adj[P].end(), rng); ^ Ioi.cpp:39:15: error: no match for 'operator[]' (operand types are 'std::vector<int> [N]' and 'std::vector<int>') int v1 = adj[P][0]; ^ Ioi.cpp:41:7: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') P = v1; ^~ In file included from /usr/include/c++/7/vector:69:0, from /usr/include/c++/7/functional:61, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from Ioi.cpp:2: /usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/vector.tcc:179:5: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' In file included from /usr/include/c++/7/vector:64:0, from /usr/include/c++/7/functional:61, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from Ioi.cpp:2: /usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' /usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:482:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'