This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Dgrader.cpp
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())
using ll = long long;
using ld = long double;
const int N = 4e5 + 10;
pair<int, int> switches[N];
int next_free = 1;
int create(vector<int> a) {
int result = next_free++;
if (sz(a) == 1) {
switches[result] = {-result, a[0]};
} else if (sz(a) == 2) {
switches[result] = {a[0], a[1]};
} else {
vector<int> left, right;
for (int i = 0; i < sz(a); ++i) {
(i % 2 ? right : left).push_back(a[i]);
}
switches[result] = {
-create(left),
-create(right)
};
}
return result;
}
void create_circuit(int m, vector<int> a) {
while (1) {
int total = sz(a) + 1;
if (!(total & (total - 1))) {
break;
}
a.push_back(-1);
}
a.push_back(0);
create(a);
vector<int> xs, ys;
for (int i = 1; i < next_free; ++i) {
xs.push_back(switches[i].x);
ys.push_back(switches[i].y);
// cout << -i << ": " << switches[i].x << " " << switches[i].y << endl;
}
answer(vector<int>(m + 1, -1), xs, ys);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |