Submission #988211

#TimeUsernameProblemLanguageResultExecution timeMemory
988211toan2602ICC (CEOI16_icc)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "icc.h" using namespace std; int par[105]; vector<int> node[105]; bool mark[105]; void make_set(int n) { for (int i = 1; i <= n; i++) {par[i] = -1; node[i].push_back(i);} } int find_anc(int x) { if(par[x] < 0) return x; return par[x] = find_anc(par[x]); } void union_set(int a, int b){ a = find_anc(a); b = find_anc(b); if(a != b) { if(abs(par[a]) < abs(par[b])) swap(a, b); for (int i: node[b]) node[a].push_back(i); par[a] += par[b]; par[b] = a; } } int ask(int n, int m, vector <int> a, vector <int> b) { int A[n], B[m]; for (int i=0; i<n; i++) A[i]=a[i]; for (int i=0; i<m; i++) B[i]=b[i]; return query(n, m, A, B); } void run(int n) { vector<int> V, a, b, a2, b2; for (int i = 1; i < n; i++) { a.clear(); b.clear(); for (int j = 1; j <= n; j++) mark[j] = false; for (int j = 1; j <= n; j++) { if(!mark[find_anc(j)]) { mark[find_anc(j)] = true; V.push_back(find_anc(j)); } } int sz = V.size(), mx = __lg(sz); for (int j = 0; j < mx; j++) { for (int v = 0; v < V.size(); v++) { if(v >> j & 1) { for (int dm: node[V[v]]) a.push_back(dm); } else { for (int dm: node[V[v]]) b.push_back(dm); } } int ans = ask(a.size(), b.size(), a, b); if(ans == 1) { int l = 0, r = a.size() - 1, mid; while(l != r) { mid = (l + r) / 2; a2.clear(); for (int i = l; i <= mid; i++) { a2.push_back(a[i]); } ans = ask(a2.size(), b.size(), a2, b); if(ans == 1) r = mid; else l = mid + 1; } a2 = {v[l]}; l = 0, r = b.size() - 1, mid; while(l != r) { mid = (l + r) / 2; b2.clear(); for (int i = l; i <= mid; i++) { b2.push_back(b[i]); } ans = ask(1, b2.size(), a2, b2); if(ans == 1) r = mid; else l = mid + 1; } b2 = {v[l]}; break; } } setRoad(a2[0], b2[0]); } } //ask //setRoad

Compilation message (stderr)

icc.cpp: In function 'void run(int)':
icc.cpp:51:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             for (int v = 0; v < V.size(); v++) {
      |                             ~~^~~~~~~~~~
icc.cpp:72:23: error: 'v' was not declared in this scope
   72 |                 a2 = {v[l]};
      |                       ^
icc.cpp:72:27: error: no match for 'operator=' (operand types are 'std::vector<int>' and '<brace-enclosed initializer list>')
   72 |                 a2 = {v[l]};
      |                           ^
In file included from /usr/include/c++/10/vector:72,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from icc.cpp:1:
/usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from icc.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
icc.cpp:73:45: warning: right operand of comma operator has no effect [-Wunused-value]
   73 |                 l = 0, r = b.size() - 1, mid;
      |                                             ^
icc.cpp:84:27: error: no match for 'operator=' (operand types are 'std::vector<int>' and '<brace-enclosed initializer list>')
   84 |                 b2 = {v[l]};
      |                           ^
In file included from /usr/include/c++/10/vector:72,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from icc.cpp:1:
/usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from icc.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~