# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
230644 | DrSwad | Mechanical Doll (IOI18_doll) | C++17 | 97 ms | 10800 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 "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int N = int(4e5) + 10;
int c[N];
int x[N], y[N];
int switches_used;
void handle(int from, int L, int R, vector<int> &a) {
if (R - L + 1 <= 0) return;
if (R - L + 1 == 1) {
c[from] = a[0];
return;
}
int at_switch = ++switches_used;
if (R - L + 1 == a.size()) c[from] = -at_switch;
int mid = (L + R) >> 1;
if (R - L + 1 > 2) {
vector<int> b(R - L + 1);
for (int i = L; i <= R; i++) {
if ((i - L) % 2 == 0) b[(i - L) / 2] = a[i];
else b[mid + (i - L + 1) / 2 - L] = a[i];
}
for (int i = L; i <= R; i++) a[i] = b[i - L];
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... |