Submission #310980

#TimeUsernameProblemLanguageResultExecution timeMemory
310980LawlietBroken Device (JOI17_broken_device)C++17
41 / 100
55 ms3568 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
 
using namespace std;
 
const int MAXN = 200;
 
int ord[MAXN];

bool blocked[MAXN];
 
void Anna(int N, long long X, int K, int P[])
{
	srand( 43278432 );

	iota( ord , ord + N , 0 );
	random_shuffle( ord , ord + N );

	memset( blocked , false , sizeof(blocked) );
	
	for(int i = 0 ; i < K ; i++)
		blocked[ P[i] ] = true;
 
	for(int i = 0 ; i < N ; i += 2)
	{
		if( blocked[ ord[i] ] || blocked[ ord[i + 1] ] ) 
		{
			Set( ord[i] , 0 ); Set( ord[i + 1] , 0 );
			continue;
		}
 
		Set( ord[i] , 1 ); Set( ord[i + 1] , X%2 ); X /= 2;
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
 
const int MAXN = 200;

int orD[MAXN];

long long Bruno(int N, int A[])
{
	srand( 43278432 );

	iota( orD , orD + N , 0 );
	random_shuffle( orD , orD + N );

	lli ans = 0;
 
	for(int i = N - 2 ; i >= 0 ; i -= 2)
		if( A[ orD[i] ] == 1 ) ans *= 2, ans += A[ orD[i + 1] ];
 
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...