This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;
void create_circuit(int m, ve<int> A) {
int n, l, s, k, z;
ve<int> C, X, Y;
ve<bool> B;
n = A.size();
l = ceil(log2(n + 1));
s = 1 << l;
C = ve<int>(m + 1);
X = ve<int>(s - 1);
Y = ve<int>(s - 1);
B = ve<bool>(s);
for (int i = 0; i <= m; i++) C[i] = -1;
for (int i = 1; i < s / 2; i++) {
X[i - 1] = -(2 * i);
Y[i - 1] = -(2 * i + 1);
}
for (int i = 0; i < s; i++) {
k = 1;
for (int j = 0; j < l - 1; j++) {
if (B[k]) {
B[k] = !B[k];
k = -Y[k - 1];
}
else {
B[k] = !B[k];
k = -X[k - 1];
}
}
if (i < n) z = A[i];
else if (i == s - 1) z = 0;
else z = -1;
if (B[k]) {
B[k] = !B[k];
Y[k - 1] = z;
}
else {
B[k] = !B[k];
X[k - 1] = z;
}
}
/*
for (int i = 0; i < s - 1; i++) {
cout << X[i] << " " << Y[i] << endl;
}
*/
answer(C, X, Y);
}
# | 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... |