Submission #61129

# Submission time Handle Problem Language Result Execution time Memory
61129 2018-07-25T08:31:11 Z 정원준(#1763) Broken Device (JOI17_broken_device) C++11
85 / 100
81 ms 3840 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define L long long

using namespace std;

void Set(int,int);

int a[150];


void Anna(int N,L X,int K,int P[]){
	int i;
	for(i=0;i<N;i++)
	{
		a[i]=0;
	}
	for(i=0;i<K;i++)
	{
		a[P[i]]=-1;
	}
	for(i=0;i<N/2;i++)
	{
		if(!X) break;
		if(a[i]!=-1&&a[N-i-1]!=-1)
		{
			if(X%3==1)
			{
				a[i]=1;
			}
			else if(X%3==2)
			{
				a[N-i-1]=1;
			}
			else
			{
				a[i]=a[N-i-1]=1;
			}
			X/=3;
		}
	}
	for(i=0;i<N;i++)
	{
		if(a[i]==1) Set(i,1);
		else Set(i,0);
	}
}

/*
int p[100010];
int aa[100010];

void Set(int loc,int val){
	aa[loc]=val;
}
L Bruno(int N,int A[]){
	L ret=0,i,bit=1;
	for(i=0;i<N/2;i++)
	{
		if(A[i]||A[N-i-1])
		{
			if(A[i]&&A[N-i-1])
			{
				ret+=bit*0;
			}
			else if(A[i])
			{
				ret+=bit*1;
			}
			else
			{
				ret+=bit*2;
			}
			bit*=3;
		}
	}
	return ret;
}

int main()
{
	L n,k,x;
	
	scanf("%lld %lld %lld",&n,&k,&x);
	for(int i=0;i<k;i++)
	{
		scanf("%lld",&p[i]);
	}
	Anna(n,x,k,p);
	for(int i=0;i<n;i++)
	{
		printf("%d ",aa[i]);
	}
	puts("");
	printf("%lld ",Bruno(n,aa));
}
//*/
#include "Brunolib.h"
#include <bits/stdc++.h>
#define L long long

using namespace std;

L Bruno(int N,int A[]){
	L ret=0,i,bit=1;
	for(i=0;i<N/2;i++)
	{
		if(A[i]||A[N-i-1])
		{
			if(A[i]&&A[N-i-1])
			{
				ret+=bit*0;
			}
			else if(A[i])
			{
				ret+=bit*1;
			}
			else
			{
				ret+=bit*2;
			}
			bit*=3;
		}
	}
	return ret;
}
# Verdict Execution time Memory Grader output
1 Partially correct 56 ms 2912 KB Output is partially correct - L* = 37
2 Partially correct 60 ms 3568 KB Output is partially correct - L* = 37
3 Partially correct 51 ms 3656 KB Output is partially correct - L* = 37
4 Partially correct 57 ms 3800 KB Output is partially correct - L* = 37
5 Partially correct 62 ms 3800 KB Output is partially correct - L* = 37
6 Partially correct 59 ms 3800 KB Output is partially correct - L* = 37
7 Partially correct 50 ms 3800 KB Output is partially correct - L* = 37
8 Partially correct 52 ms 3800 KB Output is partially correct - L* = 37
9 Partially correct 61 ms 3800 KB Output is partially correct - L* = 37
10 Partially correct 63 ms 3840 KB Output is partially correct - L* = 37
11 Partially correct 52 ms 3840 KB Output is partially correct - L* = 37
12 Partially correct 80 ms 3840 KB Output is partially correct - L* = 37
13 Partially correct 57 ms 3840 KB Output is partially correct - L* = 37
14 Partially correct 81 ms 3840 KB Output is partially correct - L* = 37
15 Partially correct 55 ms 3840 KB Output is partially correct - L* = 37
16 Partially correct 60 ms 3840 KB Output is partially correct - L* = 37
17 Partially correct 52 ms 3840 KB Output is partially correct - L* = 37
18 Partially correct 69 ms 3840 KB Output is partially correct - L* = 37
19 Partially correct 56 ms 3840 KB Output is partially correct - L* = 37
20 Partially correct 64 ms 3840 KB Output is partially correct - L* = 37
21 Partially correct 49 ms 3840 KB Output is partially correct - L* = 37
22 Partially correct 73 ms 3840 KB Output is partially correct - L* = 37
23 Partially correct 75 ms 3840 KB Output is partially correct - L* = 37
24 Partially correct 67 ms 3840 KB Output is partially correct - L* = 37
25 Partially correct 65 ms 3840 KB Output is partially correct - L* = 37
26 Partially correct 56 ms 3840 KB Output is partially correct - L* = 37
27 Partially correct 50 ms 3840 KB Output is partially correct - L* = 37
28 Partially correct 62 ms 3840 KB Output is partially correct - L* = 37
29 Partially correct 60 ms 3840 KB Output is partially correct - L* = 37
30 Partially correct 49 ms 3840 KB Output is partially correct - L* = 37
31 Partially correct 64 ms 3840 KB Output is partially correct - L* = 37
32 Partially correct 66 ms 3840 KB Output is partially correct - L* = 37
33 Partially correct 56 ms 3840 KB Output is partially correct - L* = 37
34 Partially correct 52 ms 3840 KB Output is partially correct - L* = 37
35 Partially correct 64 ms 3840 KB Output is partially correct - L* = 37
36 Partially correct 58 ms 3840 KB Output is partially correct - L* = 37
37 Partially correct 66 ms 3840 KB Output is partially correct - L* = 37
38 Partially correct 53 ms 3840 KB Output is partially correct - L* = 37
39 Partially correct 62 ms 3840 KB Output is partially correct - L* = 37
40 Partially correct 50 ms 3840 KB Output is partially correct - L* = 37