Submission #207619

# Submission time Handle Problem Language Result Execution time Memory
207619 2020-03-08T06:49:33 Z autumn_eel Broken Device (JOI17_broken_device) C++14
85 / 100
1537 ms 3568 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

bool b[160],d[160];
bool used[160];

void Anna(int N,ll X,int K,int P[]){
	static mt19937 mt(314159);
	uniform_int_distribution<>dist(0,N-1);
	memset(b,0,sizeof(b));
	memset(d,0,sizeof(d));
	memset(used,0,sizeof(used));
	rep(i,K){
		b[P[i]]=1;
	}
	rep(loop,N/2){
		int i,j;
		do{
			i=dist(mt);
			j=dist(mt);
		}while(i==j||used[i]||used[j]);
		used[i]=used[j]=true;
		if(!b[i]&&!b[j]){
			int e=X%3;
			if(e==0)d[i]=0,d[j]=1;
			if(e==1)d[i]=1,d[j]=0;
			if(e==2)d[i]=1,d[j]=1;
			X/=3;
		}
	}
	rep(i,N)Set(i,d[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

ll Bruno(int N,int A[]){
	static mt19937 mt(314159);
	uniform_int_distribution<>dist(0,N-1);
	bool used[160]{};
	ll ans=0,x=1;
	rep(loop,N/2){
		int i,j;
		do{
			i=dist(mt);
			j=dist(mt);
		}while(i==j||used[i]||used[j]);
		used[i]=used[j]=true;
		if(A[i]||A[j]){
			ans+=(A[i]*2+A[j]-1)*x;
			x*=3;
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 1519 ms 2968 KB Output is partially correct - L* = 38
2 Partially correct 1522 ms 3072 KB Output is partially correct - L* = 39
3 Partially correct 1537 ms 2992 KB Output is partially correct - L* = 38
4 Partially correct 1492 ms 2904 KB Output is partially correct - L* = 39
5 Partially correct 1496 ms 3056 KB Output is partially correct - L* = 39
6 Partially correct 1488 ms 3056 KB Output is partially correct - L* = 39
7 Partially correct 1488 ms 3080 KB Output is partially correct - L* = 38
8 Partially correct 1476 ms 3496 KB Output is partially correct - L* = 38
9 Partially correct 1462 ms 3056 KB Output is partially correct - L* = 39
10 Partially correct 1464 ms 3056 KB Output is partially correct - L* = 38
11 Partially correct 1466 ms 3376 KB Output is partially correct - L* = 38
12 Partially correct 1463 ms 3312 KB Output is partially correct - L* = 39
13 Partially correct 1495 ms 3312 KB Output is partially correct - L* = 39
14 Partially correct 1479 ms 3568 KB Output is partially correct - L* = 39
15 Partially correct 1463 ms 3072 KB Output is partially correct - L* = 38
16 Partially correct 1503 ms 3136 KB Output is partially correct - L* = 38
17 Partially correct 1468 ms 3312 KB Output is partially correct - L* = 37
18 Partially correct 1464 ms 3312 KB Output is partially correct - L* = 39
19 Partially correct 1480 ms 3312 KB Output is partially correct - L* = 37
20 Partially correct 1471 ms 3064 KB Output is partially correct - L* = 38
21 Partially correct 1478 ms 3056 KB Output is partially correct - L* = 37
22 Partially correct 1470 ms 3072 KB Output is partially correct - L* = 38
23 Partially correct 1463 ms 3312 KB Output is partially correct - L* = 38
24 Partially correct 1464 ms 3128 KB Output is partially correct - L* = 39
25 Partially correct 1464 ms 3128 KB Output is partially correct - L* = 39
26 Partially correct 1467 ms 3096 KB Output is partially correct - L* = 39
27 Partially correct 1468 ms 3568 KB Output is partially correct - L* = 38
28 Partially correct 1460 ms 3056 KB Output is partially correct - L* = 37
29 Partially correct 1470 ms 3312 KB Output is partially correct - L* = 38
30 Partially correct 1471 ms 3112 KB Output is partially correct - L* = 37
31 Partially correct 1472 ms 3568 KB Output is partially correct - L* = 39
32 Partially correct 1464 ms 3568 KB Output is partially correct - L* = 38
33 Partially correct 1464 ms 3056 KB Output is partially correct - L* = 38
34 Partially correct 1480 ms 3368 KB Output is partially correct - L* = 38
35 Partially correct 1470 ms 3072 KB Output is partially correct - L* = 37
36 Partially correct 1466 ms 3312 KB Output is partially correct - L* = 38
37 Partially correct 1468 ms 3480 KB Output is partially correct - L* = 39
38 Partially correct 1468 ms 3104 KB Output is partially correct - L* = 39
39 Partially correct 1463 ms 3568 KB Output is partially correct - L* = 38
40 Partially correct 1482 ms 2936 KB Output is partially correct - L* = 38