Submission #847193

# Submission time Handle Problem Language Result Execution time Memory
847193 2023-09-09T09:22:26 Z 12345678 Mechanical Doll (IOI18_doll) C++17
18 / 100
57 ms 11152 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=2e5+1000;
int cnt, mx, used, id;
vector<int> v, X(nx), Y(nx);

void add(int idx, int layer)
{
    used=max(used, idx);
    if (layer==mx)
    {
        if (cnt>=1) Y[idx-1]=v[cnt--], X[idx-1]=v[cnt--];
        else if (cnt==0) Y[idx-1]=v[cnt--], X[idx-1]=-1;
    }
    else
    {
        int sid=id+1;
        add(++id, layer+1);
        Y[idx-1]=-sid;
        sid=id+1;
        if (cnt>=0) add(++id, layer+1), X[idx-1]=-sid;
        else X[idx-1]=-1;
    }
    //cout<<-idx<<' '<<X[idx-1]<<' '<<Y[idx-1]<<'\n';
}

void create_circuit(int M, std::vector<int> A) {
    vector<int> C(M+1);
    C[0]=-1; C[1]=-1;
    v=A;
    v.push_back(0);
    int N=v.size();
    cnt=N-1; mx=ceil(log2(N));
    add(++id, 1);
    X.resize(used); Y.resize(used);
    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1880 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1880 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1880 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1884 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1880 KB Output is correct
2 Correct 32 ms 6988 KB Output is correct
3 Correct 32 ms 7104 KB Output is correct
4 Correct 57 ms 9984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1880 KB Output is correct
2 Correct 32 ms 6988 KB Output is correct
3 Correct 32 ms 7104 KB Output is correct
4 Correct 57 ms 9984 KB Output is correct
5 Incorrect 51 ms 11152 KB wrong motion
6 Halted 0 ms 0 KB -