# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95663 | shenxy | Mechanical Doll (IOI18_doll) | C++11 | 27 ms | 2212 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 <algorithm>
#include "doll.h"
#include <vector>
using namespace std;
int num_bits_in(int N) {
int ans = 0;
while (N != 0) {
ans += 1;
N = N >> 1;
}
return ans;
}
void create_circuit(int M, vector<int> A) {
if (M == 1) {
int evilnum = A.size() - 1;
vector<int> C(2);
C[0] = 1;
C[1] = -1;
vector<int> X(num_bits_in(A.size() - 1), 1), Y(num_bits_in(A.size() - 1), 1);
for (int i = 0; i < X.size(); i++) {
if (evilnum & (1 << i)) Y[i] = 0 - (i + 1);
else X[i] = 0 - (i + 1);
}
answer(C, X, Y);
return;
}
int N = A.size();
vector<int> exits(M + 1, 0);
int ptr = 0;
for (int i = 0; i < N; i++) {
exits[ptr] = A[i];
ptr = A[i];
}
answer(exits, {}, {});
}
Compilation message (stderr)
# | 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... |