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 "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pct __builtin_popcount
#define INF 1000000007
void create_circuit(int m, vector<int> a) {
int n = a.size();
vector<int> sc(m + 1, -1);
sc[0] = a[0];
if (n == 1) {
for (int i = 1; i <= m; i ++) sc[i] = 0;
answer(sc, {}, {});
return;
}
vector<int> b;
for (int i = 1; i < n; i ++) b.pb(a[i]);
b.pb(0);
int p = 1;
while (p < n) p *= 2;
vector<int> wx(p-1, INF);
vector<int> wy(p-1, INF);
vector<bool> t(p-1, 0);
for (int i = 0; i < p/2-1; i ++) {
wx[i] = -(i*2+1 +1);
wy[i] = -(i*2+2 +1);
}
for (int i = 0; i < p; i ++) {
int x = 0;
while (x < p-1) {
if (t[x] == 1) {
t[x] = 0;
x = x*2+2;
} else {
t[x] = 1;
x = x*2+1;
}
}
int ne = -1;
if (i >= p-n) ne = b[i-(p-n)];
if (x%2) wx[(x-1)/2] = ne;
else wy[(x-1)/2] = ne;
}
answer(sc, wx, wy);
}
# | 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... |