답안 #99317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99317 2019-03-02T11:34:38 Z TadijaSebez Broken Device (JOI17_broken_device) C++11
100 / 100
64 ms 3312 KB
#include "Annalib.h"
#define ll long long
const int N=1050;
int ans[N],p[N];
void Anna(int n, ll x, int k, int q[])
{
	for(int i=0;i<n;i++) ans[i]=p[i]=0;
	for(int i=0;i<k;i++) p[q[i]]=1;
	for(int i=0;i+2<n;i+=3)
	{
		if(p[i]+p[i+1]+p[i+2]>=2) continue;
		if(p[i])
		{
			if(x%2==0) ans[i+1]=ans[i+2]=1;
			if(x%2==1) ans[i+2]=1;
			x/=2;
		}
		else if(p[i+1])
		{
			if(x%2==0) ans[i]=1;
			if(x%2==1) ans[i+2]=1;
			x/=2;
		}
		else if(p[i+2])
		{
			if(x%2==0) ans[i]=1;
			if(x%4==1) ans[i+1]=1;
			if(x%4==3) ans[i]=ans[i+1]=1;
			if(x%2==0) x/=2;
			else x/=4;
		}
		else
		{
			if(x%4==0) ans[i]=ans[i+1]=ans[i+2]=1;
			if(x%4==1) ans[i+1]=1;
			if(x%4==2) ans[i]=ans[i+2]=1;
			if(x%4==3) ans[i]=ans[i+1]=1;
			x/=4;
		}
	}
	for(int i=0;i<n;i++) Set(i,ans[i]);
}
#include "Brunolib.h"
#define ll long long
ll Bruno(int n, int ans[])
{
	ll x=0;
	for(int i=n-3;i>=0;i-=3)
	{
		int tmp=4*ans[i]+2*ans[i+1]+ans[i+2];
		if(tmp==1) x*=2,x++;
		if(tmp==2) x*=4,x++;
		if(tmp==3) x*=2;
		if(tmp==4) x*=2;
		if(tmp==5) x*=4,x+=2;
		if(tmp==6) x*=4,x+=3;
		if(tmp==7) x*=4;
	}
	return x;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 2808 KB Output is correct - L* = 40
2 Correct 45 ms 2800 KB Output is correct - L* = 40
3 Correct 37 ms 3056 KB Output is correct - L* = 40
4 Correct 38 ms 3072 KB Output is correct - L* = 40
5 Correct 39 ms 3072 KB Output is correct - L* = 40
6 Correct 50 ms 3000 KB Output is correct - L* = 40
7 Correct 38 ms 2816 KB Output is correct - L* = 40
8 Correct 41 ms 3072 KB Output is correct - L* = 40
9 Correct 45 ms 2816 KB Output is correct - L* = 40
10 Correct 41 ms 2992 KB Output is correct - L* = 40
11 Correct 64 ms 2544 KB Output is correct - L* = 40
12 Correct 40 ms 2816 KB Output is correct - L* = 40
13 Correct 41 ms 3072 KB Output is correct - L* = 40
14 Correct 52 ms 3056 KB Output is correct - L* = 40
15 Correct 39 ms 2816 KB Output is correct - L* = 40
16 Correct 36 ms 3072 KB Output is correct - L* = 40
17 Correct 39 ms 3072 KB Output is correct - L* = 40
18 Correct 42 ms 3056 KB Output is correct - L* = 40
19 Correct 40 ms 2896 KB Output is correct - L* = 40
20 Correct 57 ms 2816 KB Output is correct - L* = 40
21 Correct 39 ms 2816 KB Output is correct - L* = 40
22 Correct 38 ms 3056 KB Output is correct - L* = 40
23 Correct 53 ms 3056 KB Output is correct - L* = 40
24 Correct 39 ms 3072 KB Output is correct - L* = 40
25 Correct 43 ms 3072 KB Output is correct - L* = 40
26 Correct 38 ms 3072 KB Output is correct - L* = 40
27 Correct 41 ms 3056 KB Output is correct - L* = 40
28 Correct 38 ms 3072 KB Output is correct - L* = 40
29 Correct 41 ms 2800 KB Output is correct - L* = 40
30 Correct 40 ms 3056 KB Output is correct - L* = 40
31 Correct 48 ms 3040 KB Output is correct - L* = 40
32 Correct 44 ms 3072 KB Output is correct - L* = 40
33 Correct 44 ms 3072 KB Output is correct - L* = 40
34 Correct 49 ms 2976 KB Output is correct - L* = 40
35 Correct 55 ms 3056 KB Output is correct - L* = 40
36 Correct 46 ms 3072 KB Output is correct - L* = 40
37 Correct 39 ms 2800 KB Output is correct - L* = 40
38 Correct 61 ms 2920 KB Output is correct - L* = 40
39 Correct 45 ms 2800 KB Output is correct - L* = 40
40 Correct 48 ms 3312 KB Output is correct - L* = 40