Submission #139288

# Submission time Handle Problem Language Result Execution time Memory
139288 2019-07-31T14:08:31 Z Lawliet Mechanical Doll (IOI18_doll) C++14
0 / 100
2 ms 204 KB
#include <bits/stdc++.h>
#include "doll.h"

using namespace std;

int N;

vector<int> X;
vector<int> Y;
vector<int> nullVector;
vector<int> onlyTrigger;

/*void answer(vector<int> C, vector<int> xx, vector<int> yy)
{
	for(int g = 0 ; g < C.size() ; g++)
		printf("%d ",C[g]);

	printf("\n\n");

	for(int g = 0 ; g < X.size() ; g++)
		printf("%d %d\n",X[g],Y[g]);
}*/

void create_circuit(int M, vector<int> A)
{
	N = A.size();

	onlyTrigger.push_back( 1 );
	onlyTrigger.push_back( -1 );

	//printf("N = %d\n",N);

	if(N == 1)
	{
		onlyTrigger.pop_back();
		onlyTrigger.push_back( 0 );
		
		answer(onlyTrigger , nullVector , nullVector);

		return;
	}	

	N--;

	int logN = log2( N );

	logN++;

	//printf("log = %d\n",logN);

	X.resize( logN);
	Y.resize( logN );

	for(int g = 0 ; g < logN - 1 ; g++)
	{
		if(N & (1 << g))
		{
			X[ g ] = 1;//VER O ULTIMO
			Y[ g ] = -g - 2;
		}
		else
		{
			X[ g ] = -g - 2;
			Y[ g ] = 1;
		}
	}

	if(N & (1 << (logN - 1)))
	{
		X[ logN - 1 ] = 1;
		Y[ logN - 1 ] = 0;
	}
	else
	{
		X[ logN - 1 ] = 0;
		Y[ logN - 1 ] = 1;
	}

	answer(onlyTrigger , X , Y);
}

/*int main()
{
	int kk;
	scanf("%d",&kk);

	vector<int> aux;

	for(int g = 0 ; g < kk ; g++)
		aux.push_back( 1 );

	create_circuit(1 , aux);
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB state 'Y'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB state 'Y'
2 Halted 0 ms 0 KB -