Submission #1060668

# Submission time Handle Problem Language Result Execution time Memory
1060668 2024-08-15T20:33:38 Z ArthuroWich Mechanical Doll (IOI18_doll) C++17
47 / 100
107 ms 12092 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
struct node {
    int l = -1, r = -1, y = 0;
};
int timer = 2, dep;
vector<int> x, y;
node tree[500005];
void build(int n, int d) {
    if (dep-1 == d) {
        return;
    }
    tree[n].l = -timer;
    timer++;
    tree[n].r = -timer;
    timer++;
    build(-tree[n].l, d+1);
    build(-tree[n].r, d+1);
}
void create(int n, int d, int v) {
    if (dep-1 == d) {
        if (tree[n].y == 0) {
            tree[n].l = v;
        } else {
            tree[n].r = v;
        }
    } else {
        if (tree[n].y == 0) {
            create(-tree[n].l, d+1, v);
        } else {
            create(-tree[n].r, d+1, v);
        }
    }
    tree[n].y ^= 1;
}
void create_circuit(int m, vector<int> a) {
    vector<int> d(m+1, 0);
    d[0] = a[0];
    int n = a.size(), s;
    dep = ceil(log2(n));
    s = 1 << dep;
    build(1, 0);
    for (int i = 1; i < s; i++) {
        if (i < a.size()) {
            create(1, 0, a[i]);
            d[a[i]] = -1;
        } else {
            create(1, 0, -1);
        }
    }
    create(1, 0, 0);
    for (int i = 1; i < s; i++) {
        x.push_back(tree[i].l);
        y.push_back(tree[i].r);
    }
    answer(d, x, y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:45:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         if (i < a.size()) {
      |             ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB Output is partially correct
2 Correct 57 ms 6216 KB Output is correct
3 Partially correct 91 ms 10800 KB Output is partially correct
4 Partially correct 97 ms 11452 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB Output is partially correct
2 Correct 57 ms 6216 KB Output is correct
3 Partially correct 91 ms 10800 KB Output is partially correct
4 Partially correct 97 ms 11452 KB Output is partially correct
5 Partially correct 104 ms 12092 KB Output is partially correct
6 Partially correct 107 ms 12064 KB Output is partially correct
7 Partially correct 97 ms 11948 KB Output is partially correct
8 Partially correct 99 ms 11684 KB Output is partially correct
9 Partially correct 90 ms 10932 KB Output is partially correct
10 Partially correct 96 ms 11604 KB Output is partially correct
11 Partially correct 99 ms 11376 KB Output is partially correct
12 Partially correct 92 ms 11104 KB Output is partially correct
13 Correct 49 ms 6340 KB Output is correct
14 Partially correct 98 ms 11388 KB Output is partially correct
15 Partially correct 95 ms 11656 KB Output is partially correct
16 Partially correct 2 ms 804 KB Output is partially correct
17 Correct 49 ms 6016 KB Output is correct
18 Correct 48 ms 6096 KB Output is correct
19 Partially correct 93 ms 11100 KB Output is partially correct
20 Partially correct 96 ms 11604 KB Output is partially correct
21 Partially correct 99 ms 11452 KB Output is partially correct
22 Partially correct 96 ms 11376 KB Output is partially correct