답안 #261482

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
261482 2020-08-11T18:53:51 Z arnold518 Broken Device (JOI17_broken_device) C++14
0 / 100
2000 ms 416 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
static const int MAXN = 150;
static const int MAXK = 40;
 
static int N, K, *P;
static ll X;
static int A[MAXN+10];

static int PP[160];
static int QQ[160];

static int cnt=1;

void Anna(int _N, ll _X, int _K, int _P[])
{
	N=_N; X=_X; K=_K; P=_P;
	for(int i=0; i<K; i++) A[QQ[P[i]]]=-1;
 
	srand(5);
	for(int i=0; i<N; i++) PP[i]=i;
	for(int i=0; i<cnt++; i++) random_shuffle(PP, PP+N);
	for(int i=0; i<N; i++) QQ[PP[i]]=i;

	ll now=X;
	for(int i=0; i<N; i+=2)
	{
		if(A[i]==-1 || A[i+1]==-1)
		{
			A[i]=0; A[i+1]=0;
		}
		else
		{
			if(now%3==0) A[i]=0, A[i+1]=1;
			else if(now%3==1) A[i]=1, A[i+1]=0;
			else if(now%3==2) A[i]=1, A[i+1]=1;
			now/=3;
		}
	}
	for(int i=0; i<N; i++) Set(PP[i], A[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
static int N, *A;

static int PP[160];
static int QQ[160];

static int cnt=1;

ll Bruno(int _N, int _A[])
{
	N=_N; A=_A;
	ll ret=0;

	srand(5);
	for(int i=0; i<N; i++) PP[i]=i;

	for(int i=0; i<cnt++; i++) random_shuffle(PP, PP+N);
	for(int i=0; i<N; i++) QQ[PP[i]]=i;

	for(int i=N-2; i>=0; i-=2)
	{
		if(A[PP[i]]==0 && A[PP[i+1]]==0) continue;
		if(A[PP[i]]==0 && A[PP[i+1]]==1) ret=ret*3+0;
		if(A[PP[i]]==1 && A[PP[i+1]]==0) ret=ret*3+1;
		if(A[PP[i]]==1 && A[PP[i+1]]==1) ret=ret*3+2;
	}
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2017 ms 256 KB Time limit exceeded
2 Execution timed out 2043 ms 256 KB Time limit exceeded
3 Execution timed out 2079 ms 256 KB Time limit exceeded
4 Execution timed out 2062 ms 256 KB Time limit exceeded
5 Execution timed out 2086 ms 256 KB Time limit exceeded
6 Execution timed out 2077 ms 256 KB Time limit exceeded
7 Execution timed out 2077 ms 256 KB Time limit exceeded
8 Execution timed out 2064 ms 256 KB Time limit exceeded
9 Execution timed out 2084 ms 256 KB Time limit exceeded
10 Execution timed out 2041 ms 256 KB Time limit exceeded
11 Execution timed out 2065 ms 256 KB Time limit exceeded
12 Execution timed out 2080 ms 256 KB Time limit exceeded
13 Execution timed out 2066 ms 256 KB Time limit exceeded
14 Execution timed out 2057 ms 256 KB Time limit exceeded
15 Execution timed out 2058 ms 256 KB Time limit exceeded
16 Execution timed out 2062 ms 256 KB Time limit exceeded
17 Execution timed out 2068 ms 256 KB Time limit exceeded
18 Execution timed out 2075 ms 256 KB Time limit exceeded
19 Execution timed out 2086 ms 256 KB Time limit exceeded
20 Execution timed out 2089 ms 256 KB Time limit exceeded
21 Execution timed out 2088 ms 256 KB Time limit exceeded
22 Execution timed out 2041 ms 256 KB Time limit exceeded
23 Execution timed out 2087 ms 256 KB Time limit exceeded
24 Execution timed out 2067 ms 256 KB Time limit exceeded
25 Execution timed out 2082 ms 256 KB Time limit exceeded
26 Execution timed out 2085 ms 256 KB Time limit exceeded
27 Execution timed out 2047 ms 416 KB Time limit exceeded
28 Execution timed out 2080 ms 256 KB Time limit exceeded
29 Execution timed out 2079 ms 256 KB Time limit exceeded
30 Execution timed out 2079 ms 256 KB Time limit exceeded
31 Execution timed out 2078 ms 256 KB Time limit exceeded
32 Execution timed out 2089 ms 256 KB Time limit exceeded
33 Execution timed out 2082 ms 256 KB Time limit exceeded
34 Execution timed out 2082 ms 256 KB Time limit exceeded
35 Execution timed out 2051 ms 256 KB Time limit exceeded
36 Execution timed out 2086 ms 384 KB Time limit exceeded
37 Execution timed out 2096 ms 256 KB Time limit exceeded
38 Execution timed out 2065 ms 256 KB Time limit exceeded
39 Execution timed out 2068 ms 256 KB Time limit exceeded
40 Execution timed out 2085 ms 256 KB Time limit exceeded