Submission #120291

# Submission time Handle Problem Language Result Execution time Memory
120291 2019-06-24T06:52:51 Z turbat Mechanical Doll (IOI18_doll) C++14
37 / 100
104 ms 9740 KB
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;

int n, m, s, cnt;
vector <int> x, y, c, a;

void build (int node, int l, int r, int idx, int p){
    if (r - l == 1){
        if (idx >= n) x[node - 1] = -1; 
        else x[node - 1] = a[idx];
        if (idx + p >= n) y[node - 1] = -1;
        else y[node - 1] = a[idx + p];
        return;
    }
    int mid = (l + r) / 2;
    x[node - 1] =  -(node * 2);
    y[node - 1] = -(node * 2 + 1);
    build (node * 2, l, mid, idx, p * 2);
    build (node * 2 + 1, l, mid, idx + p, p * 2);
}

void create_circuit(int M, vector<int> A) {
    a = A;
    s = n = A.size();
    m = M;
    while (__builtin_popcount(s) != 1) s += s & -s;
    if (s == n) s *= 2;
    x.resize(s - 1);
    y.resize(s - 1);
    c.resize(m + 1);
    for (int i = 0;i <= m;i++) c[i] = -1;
    build(1, 0, s - 1, 0, 1);
    if (n == s) c[A.back()] = 0;
    else y[s - 2] = 0;
    // for (int i = 0;i <= m;i++) cout <<i << ' '<< c[i]<< endl;
    // for (int i = 0;i < s - 1;i++) cout << i + 1<< ' '<< x[i] << ' '<< y[i]<< endl;
    answer(c, x, y);
}   
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Output is partially correct
2 Partially correct 84 ms 8052 KB Output is partially correct
3 Partially correct 72 ms 8088 KB Output is partially correct
4 Partially correct 91 ms 8768 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Output is partially correct
2 Partially correct 84 ms 8052 KB Output is partially correct
3 Partially correct 72 ms 8088 KB Output is partially correct
4 Partially correct 91 ms 8768 KB Output is partially correct
5 Partially correct 89 ms 9740 KB Output is partially correct
6 Partially correct 85 ms 9508 KB Output is partially correct
7 Partially correct 94 ms 9644 KB Output is partially correct
8 Partially correct 104 ms 9248 KB Output is partially correct
9 Partially correct 77 ms 8012 KB Output is partially correct
10 Partially correct 83 ms 9236 KB Output is partially correct
11 Partially correct 84 ms 8876 KB Output is partially correct
12 Partially correct 69 ms 8312 KB Output is partially correct
13 Partially correct 71 ms 8632 KB Output is partially correct
14 Partially correct 75 ms 8704 KB Output is partially correct
15 Partially correct 73 ms 8888 KB Output is partially correct
16 Partially correct 3 ms 588 KB Output is partially correct
17 Correct 52 ms 4900 KB Output is correct
18 Partially correct 82 ms 8372 KB Output is partially correct
19 Partially correct 74 ms 8328 KB Output is partially correct
20 Partially correct 92 ms 9056 KB Output is partially correct
21 Partially correct 81 ms 8856 KB Output is partially correct
22 Partially correct 96 ms 8896 KB Output is partially correct