# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290953 | Tc14 | Meetings (IOI18_meetings) | C++17 | 0 ms | 0 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.
//#pragma GCC optimize("O3")
#include <bits/stdc++.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, int* A) {
int n, l, s, k, z;
int *C, *X, *Y;
ve<bool> B;
n = 10;
l = max((int)ceil(log2(n)), 1);
s = 1 << l;
cout << n << endl;
C = new int[m + 1];
X = new int[s - 1];
Y = new 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 = i + 1;
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);
}