Submission #54886

# Submission time Handle Problem Language Result Execution time Memory
54886 2018-07-05T08:53:10 Z linkret Printed Circuit Board (CEOI12_circuit) C++14
Compilation error
0 ms 0 KB
#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());

	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

circuit.cpp: In function 'void init(int, 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> >'