Submission #131725

# Submission time Handle Problem Language Result Execution time Memory
131725 2019-07-17T13:30:56 Z mahmoudbadawy Broken Device (JOI17_broken_device) C++17
100 / 100
61 ms 3312 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

int br[155];

void Anna( int N, long long X, int K, int P[] ){
	srand(123321);
	vector<int> p;
	for(int i=0;i<N;i++) p.push_back(i);
	random_shuffle(p.begin(),p.end());
	for(int i=0;i<N;i++) br[i]=0;
	for(int i=0;i<K;i++) br[P[i]]=1;
	/*for(int i=0;i<N;i+=2)
	{
		if(br[p[i]]||br[p[i+1]])
			br[p[i]]=br[p[i+1]]=1;
	}*/
	for(int i=0;i<N;i+=2)
	{
		int b=X%3;
		if(b==0 && !br[p[i+1]])
		{
			Set(p[i],0); Set(p[i+1],1);
		}
		else if(b==1 && !br[p[i]]) 
		{
			Set(p[i],1); Set(p[i+1],0);
		}
		else if(b==2 && (br[p[i]]+br[p[i+1]]==0))
		{
			Set(p[i],1); Set(p[i+1],1);
		}
		else
		{
			Set(p[i],0); Set(p[i+1],0); continue;
		}
		X/=3;
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

long long Bruno( int N, int A[] ){
	srand(123321);
	//long long xr=827550094985275787;
	vector<int> p;
	for(int i=0;i<N;i++) p.push_back(i);
	random_shuffle(p.begin(),p.end());
	vector<int> v;
	for(int i=0;i<N;i+=2)
	{
		if(A[p[i]]+A[p[i+1]]==0) continue;
		if(A[p[i]]==0&&A[p[i+1]]==1) v.push_back(0);
		else if(A[p[i]]==1&&A[p[i+1]]==0) v.push_back(1);
		else v.push_back(2);
	}
	long long x=0;
	for(int i=v.size()-1;i>=0;i--){x*=3; x+=v[i];}
	return x;
}
# Verdict Execution time Memory Grader output
1 Correct 56 ms 3056 KB Output is correct - L* = 40
2 Correct 56 ms 3312 KB Output is correct - L* = 40
3 Correct 57 ms 3056 KB Output is correct - L* = 40
4 Correct 56 ms 3064 KB Output is correct - L* = 40
5 Correct 56 ms 3056 KB Output is correct - L* = 40
6 Correct 56 ms 3056 KB Output is correct - L* = 40
7 Correct 56 ms 3056 KB Output is correct - L* = 40
8 Correct 56 ms 3056 KB Output is correct - L* = 40
9 Correct 56 ms 3056 KB Output is correct - L* = 40
10 Correct 56 ms 3056 KB Output is correct - L* = 40
11 Correct 56 ms 3056 KB Output is correct - L* = 40
12 Correct 57 ms 3056 KB Output is correct - L* = 40
13 Correct 56 ms 3056 KB Output is correct - L* = 40
14 Correct 57 ms 3056 KB Output is correct - L* = 40
15 Correct 56 ms 2872 KB Output is correct - L* = 40
16 Correct 56 ms 3056 KB Output is correct - L* = 40
17 Correct 56 ms 3056 KB Output is correct - L* = 40
18 Correct 56 ms 3056 KB Output is correct - L* = 40
19 Correct 56 ms 3056 KB Output is correct - L* = 40
20 Correct 56 ms 3056 KB Output is correct - L* = 40
21 Correct 56 ms 3056 KB Output is correct - L* = 40
22 Correct 61 ms 3160 KB Output is correct - L* = 40
23 Correct 56 ms 3056 KB Output is correct - L* = 40
24 Correct 56 ms 3056 KB Output is correct - L* = 40
25 Correct 56 ms 3056 KB Output is correct - L* = 40
26 Correct 56 ms 3056 KB Output is correct - L* = 40
27 Correct 56 ms 3056 KB Output is correct - L* = 40
28 Correct 57 ms 3064 KB Output is correct - L* = 40
29 Correct 56 ms 3056 KB Output is correct - L* = 40
30 Correct 56 ms 3056 KB Output is correct - L* = 40
31 Correct 56 ms 3056 KB Output is correct - L* = 40
32 Correct 59 ms 3056 KB Output is correct - L* = 40
33 Correct 56 ms 3056 KB Output is correct - L* = 40
34 Correct 59 ms 3056 KB Output is correct - L* = 40
35 Correct 59 ms 3056 KB Output is correct - L* = 40
36 Correct 56 ms 3056 KB Output is correct - L* = 40
37 Correct 56 ms 3056 KB Output is correct - L* = 40
38 Correct 57 ms 3056 KB Output is correct - L* = 40
39 Correct 56 ms 3056 KB Output is correct - L* = 40
40 Correct 56 ms 3056 KB Output is correct - L* = 40