Submission #54882

#TimeUsernameProblemLanguageResultExecution timeMemory
54882linkretPrinted Circuit Board (CEOI12_circuit)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define f first #define s second const int maxn = 1 << 17; int n; pii p[maxn]; vector<pii> seg[4 * maxn]; void init(int i, int l, int r) { if(l == r) { if(l < n) seg[i].push_back(p[i]); return; } int m = (l + r + 1) / 2; init(i * 2, l, m - 1); init(i * 2 + 1, m, r); seg[i].resize(seg[i * 2].size() + seg[i * 2 + 1].size(), 0); for(const pii &j : seg[i * 2]) seg[i] = j; for(const pii &j : seg[i * 2 + 1]) seg[i] = j; //sort(seg[i].begin(), seg[i].end()); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; // assert(n <= 1000); for(int i = 0; i < n; i++) { cin >> p[i].f >> p[i].s; } init(1, 1, maxn); cout << 0 << endl; return 0; }

Compilation message (stderr)

circuit.cpp: In function 'void init(int, int, int)':
circuit.cpp:27:60: error: no matching function for call to 'std::vector<std::pair<int, int> >::resize(std::vector<std::pair<int, int> >::size_type, int)'
  seg[i].resize(seg[i * 2].size() + seg[i * 2 + 1].size(), 0);
                                                            ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from circuit.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:689:7: note: candidate: void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int]
       resize(size_type __new_size)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:689:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/7/bits/stl_vector.h:709:7: note: candidate: void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       resize(size_type __new_size, const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:709:7: note:   no known conversion for argument 2 from 'int' to 'const value_type& {aka const std::pair<int, int>&}'
circuit.cpp:30:12: error: no match for 'operator=' (operand types are 'std::vector<std::pair<int, int> >' and 'const pii {aka const std::pair<int, int>}')
   seg[i] = j;
            ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from circuit.cpp:1:
/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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'const pii {aka const std::pair<int, int>}' to 'const std::vector<std::pair<int, int> >&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from circuit.cpp:1:
/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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, 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 'const pii {aka const std::pair<int, int>}' to 'std::vector<std::pair<int, 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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, 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 'const pii {aka const std::pair<int, int>}' to 'std::initializer_list<std::pair<int, int> >'
circuit.cpp:33:12: error: no match for 'operator=' (operand types are 'std::vector<std::pair<int, int> >' and 'const pii {aka const std::pair<int, int>}')
   seg[i] = j;
            ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from circuit.cpp:1:
/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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'const pii {aka const std::pair<int, int>}' to 'const std::vector<std::pair<int, int> >&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from circuit.cpp:1:
/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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, 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 'const pii {aka const std::pair<int, int>}' to 'std::vector<std::pair<int, 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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, 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 'const pii {aka const std::pair<int, int>}' to 'std::initializer_list<std::pair<int, int> >'