Submission #123027

# Submission time Handle Problem Language Result Execution time Memory
123027 2019-06-30T03:41:23 Z teki Mechanical Doll (IOI18_doll) C++11
0 / 100
17 ms 17072 KB
#include "doll.h"
#include <bits/stdc++.h>

typedef long long ll;

#define pb push_back
#define MS(x,y) memset((x),(y),sizeof((x)))
#define mn 1000000

using namespace std;

int n,sw,p=1;
vector<int> x(1<<20),y(1<<20);
bitset <(1<<20)> b;

int build(int left, int right) {
    if (left >= right) return 0;
    else if (right < p-n) return -1;

    int ts = sw;
    sw++;

    int mid = (left+right)/2;

    x[ts-1] = build(left, mid);
    y[ts-1] = build(mid+1, right);

    return ts;
}

void pt (int i, int j) {
    int a;

    if (b[-i]) a = y[-i-1];
    else a = x[-i-1];

    b[-i] = !b[-i];

    if (a <= 0) a = j;
    else pt(a,j);
}

void create_circuit(int m, vector<int> a) {
    n = (int)a.size();

    while (p < n) p*=2;

    build(0, p-1);

    for (int i = 1; i<n; i++) pt(-1,a[i]);
    if (n == 1) pt(-1,-1);
    pt(-1,0);

    vector<int> c(m+1, 1);
    x.resize(sw);
    y.resize(sw);

    c[0] = a[0];

    answer(c,x,y);
}
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 17072 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 17072 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 17072 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 16972 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 16972 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 16972 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -