# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068718 | TheQuantiX | 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.
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
using ll = long long;
constexpr ll INF = 1000000000 - 1;
ll nxt = -2;
void create_circuit(int M, vector<int> A) {
ll NN = A.size();
A.push_back(-1);
ll N = A.size();
ll ex = 1;
while (ex < N) {
ex *= 2;
}
while (A.size() < ex) {
A.push_back(-1);
}
N = A.size();
A[N - 1] = 0;
vector<int> C, X, Y;
C.push_back(-1);
for (int i = 0; i < M; i++) {
C.push_back(-1);
}
X.resize(N - 1);
Y.resize(N - 1);
for (int i = 1; i < N / 2; i++) {
X[i - 1] = -(i * 2);
Y[i - 1] = -(i * 2 + 1);
}
for (int i = N / 2; i <= N - 1; i++) {
ll x = i - N / 2;
ll e = 0;
for (int j = 1; j < N / 2; j *= 2) {
e *= 2;
e += (x & 1);
x /= 2;
}
// cout << i - N / 2 << ' ' << e << '\n';
X[i - 1] = A[e];
Y[i - 1] = A[e + N / 2];
}
// for (int i = 0; i < X.size(); i++) {
// cout << X[i] << ' ' << Y[i] << '\n';
// }
if (X.size() > NN * 2) {
exit(-1);
// C[0] = 0;
}
answer(C, X, Y);
}