Submission #788952

# Submission time Handle Problem Language Result Execution time Memory
788952 2023-07-20T18:20:33 Z ToniB Mechanical Doll (IOI18_doll) C++17
46 / 100
101 ms 16360 KB
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int MAXN = 400000;

int n, m, cur = 1, s, x[MAXN], y[MAXN];
vector<int> a;
vector<int> c, x_ans, y_ans;

void dfs(int node, vector<int> v){
	cur = max(cur, node);
	if(v.size() == 2){
		x[node - 1] = v[0];
		y[node - 1] = v[1];
		return ;
	}
	x[node - 1] = -node * 2;
	y[node - 1] = -(node * 2 + 1);

	vector<int> L, R;
	for(int i = 0; i < (int)v.size(); ++i){
		if(i & 1) R.push_back(v[i]);
		else L.push_back(v[i]);
	}
	dfs(node * 2, L);
	dfs(node * 2 + 1, R);
}

void create_circuit(int _m, vector<int> _a){
	m = _m; a = _a; n = a.size();
	if(m == 1){
		int p = 0;
		while((1 << p) <= n) ++p;
		c = {-p, -p};
		x_ans.resize(p); y_ans.resize(p);
		int sum = 0;
		for(int i = p - 1; i >= 0; --i){
			if(n & 1 << i){
				x_ans[i] = 1;
				sum += 1 << i;
			}
			else x_ans[i] = -p;
			y_ans[i] = -i;
		}
		answer(c, x_ans, y_ans);
		return ;
	}
	for(int i = 0; i <= m; ++i) c.push_back(-1);
	int p = 1;
	while(p < n + 1){
		p *= 2;
	}
	for(int i = n + 1; i < p; ++i) a.push_back(-1);
	a.push_back(0);
	dfs(1, a);
	x_ans.resize(cur); y_ans.resize(cur);
	for(int i = 0; i < cur; ++i){
		x_ans[i] = x[i];
		y_ans[i] = y[i];
	}
	answer(c, x_ans, y_ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 10 ms 2752 KB Output is correct
3 Correct 10 ms 2700 KB Output is correct
4 Correct 16 ms 4028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 10 ms 2752 KB Output is correct
3 Correct 10 ms 2700 KB Output is correct
4 Correct 16 ms 4028 KB Output is correct
5 Partially correct 101 ms 16360 KB Output is partially correct
6 Partially correct 95 ms 16152 KB Output is partially correct
7 Partially correct 84 ms 16268 KB Output is partially correct
8 Partially correct 84 ms 16072 KB Output is partially correct
9 Partially correct 73 ms 14680 KB Output is partially correct
10 Partially correct 90 ms 16036 KB Output is partially correct
11 Partially correct 79 ms 15712 KB Output is partially correct
12 Partially correct 74 ms 14812 KB Output is partially correct
13 Partially correct 77 ms 15188 KB Output is partially correct
14 Partially correct 77 ms 15128 KB Output is partially correct
15 Partially correct 78 ms 15304 KB Output is partially correct
16 Partially correct 3 ms 724 KB Output is partially correct
17 Correct 42 ms 8280 KB Output is correct
18 Partially correct 74 ms 14780 KB Output is partially correct
19 Partially correct 73 ms 14780 KB Output is partially correct
20 Partially correct 80 ms 15924 KB Output is partially correct
21 Partially correct 80 ms 15652 KB Output is partially correct
22 Partially correct 83 ms 15760 KB Output is partially correct