Submission #433833

# Submission time Handle Problem Language Result Execution time Memory
433833 2021-06-20T11:13:02 Z AugustinasJucas Mechanical Doll (IOI18_doll) C++14
37 / 100
180 ms 12336 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int m;
vector<int> eil;
const int dydis = 400000 + 1100;
int state[dydis] = {};
int X[dydis];
int Y[dydis];
int n;
int dbInd = 0;
int closestPower(int a){
	for(int i = a+1; i <= a * 2 + 2; i++){
		if(__builtin_popcount(i) == 1) return i;
	}
	return -1;
}
int dfs(int v){
	if(v >= n){
		int ret = 0;
		if(dbInd == (int)eil.size()) {
			ret = -1;
		}else{
			ret = eil[dbInd++];
		}
		//cout << "dabar " << ret << "\n";
		return ret;
	}else{
		int sk = dfs(v*2 + state[v]);
		if(state[v] == 0) X[v-1] = sk;
		else Y[v-1] = sk;
		state[v] = !state[v];
		return -v;
	}
}
void create_circuit(int M, vector<int> A) {
	eil = A;
	vector<int> C(M+1, -1); C[0] = -1;
	n = closestPower(A.size());
	for(int i = 0; i < n; i++) dfs(1);
	vector<int> XX; 
	for(int i = 0; i < n-1; i++){
		XX.push_back(X[i]);
		//cout << -(i+1) << " x-as yra " << X[i] << endl;
	}
	vector<int> YY; 
	for(int i = 0; i < n-1; i++) {
		YY.push_back(Y[i]);
		//cout << -i - 1 << " y-as yra " << Y[i] << endl;
	}
	
	if((int)A.size() == n){
		C[M] = 0;
	}
	else{
		YY[YY.size()-1] = 0;
	}
//	cout << "arciausias " << A.size() << " laipsnis yra " << n << endl;
	answer(C, XX, YY);
	return ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 204 KB Output is partially correct
2 Partially correct 153 ms 11172 KB Output is partially correct
3 Partially correct 147 ms 11196 KB Output is partially correct
4 Partially correct 154 ms 12000 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 204 KB Output is partially correct
2 Partially correct 153 ms 11172 KB Output is partially correct
3 Partially correct 147 ms 11196 KB Output is partially correct
4 Partially correct 154 ms 12000 KB Output is partially correct
5 Partially correct 180 ms 12336 KB Output is partially correct
6 Partially correct 162 ms 12112 KB Output is partially correct
7 Partially correct 157 ms 12228 KB Output is partially correct
8 Partially correct 159 ms 12088 KB Output is partially correct
9 Partially correct 140 ms 11176 KB Output is partially correct
10 Partially correct 153 ms 12028 KB Output is partially correct
11 Partially correct 164 ms 11992 KB Output is partially correct
12 Partially correct 141 ms 11204 KB Output is partially correct
13 Partially correct 151 ms 11248 KB Output is partially correct
14 Partially correct 153 ms 11260 KB Output is partially correct
15 Partially correct 148 ms 11412 KB Output is partially correct
16 Partially correct 4 ms 716 KB Output is partially correct
17 Correct 86 ms 6584 KB Output is correct
18 Partially correct 142 ms 11144 KB Output is partially correct
19 Partially correct 143 ms 11176 KB Output is partially correct
20 Partially correct 155 ms 11960 KB Output is partially correct
21 Partially correct 156 ms 11964 KB Output is partially correct
22 Partially correct 172 ms 11952 KB Output is partially correct