Submission #954852

# Submission time Handle Problem Language Result Execution time Memory
954852 2024-03-28T17:39:22 Z Trisanu_Das Mechanical Doll (IOI18_doll) C++17
37 / 100
57 ms 11168 KB
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
 
vector<int> seq, X, Y, C;
int sz, dpth, layer;
 
void dfs(int u, int d, int v){
	if(d < dpth){
		dfs(u * 2, d + 1, v);
		dfs(u * 2 + 1, d + 1, v + (1 << (d - 1)));
		X[u - 1] = -u * 2; Y[u - 1] = X[u - 1] - 1;
	}else{
		X[u - 1] = (v >= sz - 1 ? -1 : seq[v]);
		if(v + (1 << (d - 1)) == (1 << dpth) - 1) Y[u - 1] = 0;
		else Y[u - 1] = (v + (1 << (d - 1)) >= sz - 1 ? -1 : seq[v + (1 << (d - 1))]);
	}
}
 
void create_circuit(int M, vector<int> A){
	seq.clear(), X.clear(), Y.clear(), C.clear();
	seq = A;
	sz = seq.size() + 1;
	dpth = log2(sz);
	if((1 << dpth) != sz) dpth++;
	layer = (1 << dpth) - 1;
	X.resize(layer), Y.resize(layer), C.resize(M + 1);
	dfs(1, 1, 0);
	for(int i = 0; i <= M; i++) C[i] = -1;
	answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 46 ms 9048 KB Output is partially correct
3 Partially correct 46 ms 9040 KB Output is partially correct
4 Partially correct 55 ms 10332 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 46 ms 9048 KB Output is partially correct
3 Partially correct 46 ms 9040 KB Output is partially correct
4 Partially correct 55 ms 10332 KB Output is partially correct
5 Partially correct 57 ms 11160 KB Output is partially correct
6 Partially correct 56 ms 10964 KB Output is partially correct
7 Partially correct 56 ms 11168 KB Output is partially correct
8 Partially correct 54 ms 10804 KB Output is partially correct
9 Partially correct 46 ms 9048 KB Output is partially correct
10 Partially correct 54 ms 10804 KB Output is partially correct
11 Partially correct 53 ms 10556 KB Output is partially correct
12 Partially correct 47 ms 9316 KB Output is partially correct
13 Partially correct 48 ms 9800 KB Output is partially correct
14 Partially correct 49 ms 9796 KB Output is partially correct
15 Partially correct 49 ms 9896 KB Output is partially correct
16 Partially correct 2 ms 860 KB Output is partially correct
17 Correct 35 ms 5972 KB Output is correct
18 Partially correct 47 ms 9288 KB Output is partially correct
19 Partially correct 49 ms 9160 KB Output is partially correct
20 Partially correct 54 ms 10552 KB Output is partially correct
21 Partially correct 54 ms 10436 KB Output is partially correct
22 Partially correct 53 ms 10424 KB Output is partially correct