Submission #1009661

# Submission time Handle Problem Language Result Execution time Memory
1009661 2024-06-27T18:46:47 Z aaaaaarroz Mechanical Doll (IOI18_doll) C++17
47 / 100
101 ms 14800 KB
    #include "doll.h"
    #include <bits/stdc++.h>
     
    using namespace std;
     
    int S = 0;
    vector<int> X, Y;
     
    int create_switch(int L, int R) {
        X.push_back(L);
        Y.push_back(R);
        S++;
        return -S;
    }
     
    int build(vector<int> v) {
        if ((int)v.size() == 1) {
            return v[0];
        }
        if (v[0] == -1 && v.back() == -1) {
            return -1;
        }
        int m = (int)v.size();
        int L, R;
        if (m & 1) {
            if (v.back()) {
                v.push_back(-1);
            } else {
                v.pop_back();
                v.push_back(-1);
                v.push_back(0);
            }
            m++;
        }
        vector<int> lv, rv;
        for (int i = 0; i < m; i++) {
            if (i & 1) rv.push_back(v[i]);
            else lv.push_back(v[i]);
        }
     
        L = build(lv);
        R = build(rv);
        return create_switch(L, R);
    }
     
    void create_circuit(int M, vector<int> A) {
        A.push_back(0);
        int t = A[0];
        A.erase(A.begin());
     
        create_switch(-1, -1);
        
        int root = build(A);
        Y[0] = root;
        vector<int> C(M + 1, root);
        C[0] = t;
        
        answer(C, X, Y);
    }
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 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 37 ms 6980 KB Output is correct
3 Partially correct 65 ms 12484 KB Output is partially correct
4 Partially correct 67 ms 13408 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB Output is partially correct
2 Correct 37 ms 6980 KB Output is correct
3 Partially correct 65 ms 12484 KB Output is partially correct
4 Partially correct 67 ms 13408 KB Output is partially correct
5 Partially correct 76 ms 14408 KB Output is partially correct
6 Partially correct 79 ms 14800 KB Output is partially correct
7 Partially correct 74 ms 14152 KB Output is partially correct
8 Partially correct 73 ms 14032 KB Output is partially correct
9 Partially correct 67 ms 13260 KB Output is partially correct
10 Partially correct 101 ms 14232 KB Output is partially correct
11 Partially correct 77 ms 14228 KB Output is partially correct
12 Partially correct 67 ms 12740 KB Output is partially correct
13 Correct 49 ms 7496 KB Output is correct
14 Partially correct 73 ms 13256 KB Output is partially correct
15 Partially correct 78 ms 13172 KB Output is partially correct
16 Partially correct 2 ms 604 KB Output is partially correct
17 Correct 38 ms 7320 KB Output is correct
18 Correct 45 ms 7216 KB Output is correct
19 Partially correct 66 ms 12740 KB Output is partially correct
20 Partially correct 74 ms 13628 KB Output is partially correct
21 Partially correct 71 ms 13700 KB Output is partially correct
22 Partially correct 80 ms 13644 KB Output is partially correct