Submission #128011

# Submission time Handle Problem Language Result Execution time Memory
128011 2019-07-10T10:25:31 Z Utaha Broken Device (JOI17_broken_device) C++14
100 / 100
65 ms 3320 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

void Anna( int N, long long X, int K, int P[] ){
	int partner[150];
	srand(123987654);
	vector<int> s;

	vector<int> v;
	for(int i=0;i<150;i++) v.pb(i);
	random_shuffle(v.begin(),v.end());
	for(int i=0;i<150;i+=2){
		partner[v[i]]=v[i+1];
		partner[v[i+1]]=v[i];
		s.pb(v[i]);
	}
	// for(int i=0;i<N;i++) cout<<partner[i]<<" \n"[i==N-1];

	X^=0x84d9302917c854LL;
	// std::cout<<X<<'\n';
	// for(long long i=X;i;i/=3) std::cout<<i%3;
	// std::cout<<'\n';
	bool ret[150]={0};
	bool notused[150]={0};
	for(int i=0;i<K;i++){
		notused[P[i]]=1;
	}
	int pt=38;
	for(int i:s){
		long long type=X%3;
		if(type==0){
			if(notused[i]) continue;
			ret[i]=1;
			ret[partner[i]]=0;
		}
		else if(type==1){
			if(notused[partner[i]]) continue;
			ret[i]=0;
			ret[partner[i]]=1;
		}
		else{
			if(notused[i]||notused[partner[i]]) continue;
			ret[i]=ret[partner[i]]=1;
		}
		// std::cout<<X%3<<'\n';
		X/=3;
		if(X==0) break;
		pt--;
		if(pt==0) break;
	}
	// for(int i=0;i<N;i++) std::cout<<ret[i];
	// std::cout<<'\n';
	for(int i=0;i<N;i++) Set(i,ret[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
long long Bruno( int N, int A[] ){
	int partner2[150];
	vector<int> s2;
	srand(123987654);

	vector<int> v;
	for(int i=0;i<150;i++) v.pb(i);
	random_shuffle(v.begin(),v.end());
	for(int i=0;i<150;i+=2){
		partner2[v[i]]=v[i+1];
		partner2[v[i+1]]=v[i];
		s2.pb(v[i]);
	}
	// for(int i=0;i<N;i++) cout<<partner2[i]<<" \n"[i==N-1];

	long long ret=0;
	long long base=1;
	for(int i:s2){
		if(A[i]==0&&A[partner2[i]]==0) continue;

		int type=-1;
		if(A[i]==1){
			if(A[partner2[i]]==1) type=2;
			else type=0;
		}
		else type=1;

		// std::cout<<"Bruno: "<<type<<'\n';

		ret+=base*type;
		base*=3;
	}
	// std::cout<<ret<<'\n';
	return ret^0x84d9302917c854LL;
}
# Verdict Execution time Memory Grader output
1 Correct 56 ms 3312 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 57 ms 3312 KB Output is correct - L* = 40
5 Correct 56 ms 3312 KB Output is correct - L* = 40
6 Correct 57 ms 3312 KB Output is correct - L* = 40
7 Correct 56 ms 3312 KB Output is correct - L* = 40
8 Correct 57 ms 3312 KB Output is correct - L* = 40
9 Correct 56 ms 3312 KB Output is correct - L* = 40
10 Correct 56 ms 3312 KB Output is correct - L* = 40
11 Correct 59 ms 3184 KB Output is correct - L* = 40
12 Correct 56 ms 3312 KB Output is correct - L* = 40
13 Correct 56 ms 3312 KB Output is correct - L* = 40
14 Correct 56 ms 3312 KB Output is correct - L* = 40
15 Correct 56 ms 3312 KB Output is correct - L* = 40
16 Correct 56 ms 3320 KB Output is correct - L* = 40
17 Correct 56 ms 3312 KB Output is correct - L* = 40
18 Correct 56 ms 3312 KB Output is correct - L* = 40
19 Correct 56 ms 3312 KB Output is correct - L* = 40
20 Correct 56 ms 3320 KB Output is correct - L* = 40
21 Correct 57 ms 3312 KB Output is correct - L* = 40
22 Correct 57 ms 3312 KB Output is correct - L* = 40
23 Correct 57 ms 3312 KB Output is correct - L* = 40
24 Correct 59 ms 3312 KB Output is correct - L* = 40
25 Correct 56 ms 3320 KB Output is correct - L* = 40
26 Correct 57 ms 3312 KB Output is correct - L* = 40
27 Correct 56 ms 3312 KB Output is correct - L* = 40
28 Correct 59 ms 3312 KB Output is correct - L* = 40
29 Correct 56 ms 3312 KB Output is correct - L* = 40
30 Correct 57 ms 3312 KB Output is correct - L* = 40
31 Correct 57 ms 3320 KB Output is correct - L* = 40
32 Correct 56 ms 3312 KB Output is correct - L* = 40
33 Correct 56 ms 3312 KB Output is correct - L* = 40
34 Correct 57 ms 3312 KB Output is correct - L* = 40
35 Correct 56 ms 3312 KB Output is correct - L* = 40
36 Correct 56 ms 3312 KB Output is correct - L* = 40
37 Correct 65 ms 3312 KB Output is correct - L* = 40
38 Correct 56 ms 3320 KB Output is correct - L* = 40
39 Correct 56 ms 3064 KB Output is correct - L* = 40
40 Correct 57 ms 3320 KB Output is correct - L* = 40