# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54880 | linkret | Printed Circuit Board (CEOI12_circuit) | C++14 | 62 ms | 28280 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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].reserve(seg[i * 2].size() + seg[i * 2 + 1].size());
for(const pii &j : seg[i * 2])
seg[i].push_back(j);
for(const pii &j : seg[i * 2 + 1])
seg[i].push_back(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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |