답안 #260358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260358 2020-08-10T06:49:26 Z 송준혁(#5057) Broken Device (JOI17_broken_device) C++14
0 / 100
63 ms 3328 KB
#include "Annalib.h"
static int A[160];

void Anna(int N, long long X, int K, int P[]){
	int cnt=0;
	for (int i=0; i<N; i++) A[i] = 0;
	for (int i=0; i<K; i++) A[P[i]] = 1;
	for (int i=0; i<N; i+=3){
		if (A[i]+A[i+1]+A[i+2] == 3 && cnt<60){
			if ((X&(1ll<<cnt)) && (X&(1ll<<cnt+1))) A[i]=A[i+1]=A[i+2]=1;
			if ((X&(1ll<<cnt)) && !(X&(1ll<<cnt+1))) A[i]=A[i+2]=1, A[i+1]=0;
			if (!(X&(1ll<<cnt)) && (X&(1ll<<cnt+1))) A[i]=A[i+2]=0, A[i+1]=1;
			if (!(X&(1ll<<cnt)) && !(X&(1ll<<cnt+1))) A[i+1]=A[i+2]=1, A[i]=0;
			cnt += 2;
		}
		else if (A[i]+A[i+1]+A[i+2] == 2 && cnt<60){
			if (X&(1ll<<cnt)){
				if (A[i+2]) A[i]=A[i+1]=1, A[i+2]=0;
				else A[i+2]=1, A[i]=A[i+1]=0;
				cnt++;
			}
			else if (A[i]){
				if (X&(1ll<<cnt+1)) A[i]=A[i+2]=0, A[i+1]=1;
				else A[i]=0, A[i+1]=A[i+2]=1;
				cnt+=2;
			}
			else A[i]=1, A[i+1]=A[i+2]=0, cnt++;
		}
		else A[i]=A[i+1]=A[i+2]=0;
	}
	for (int i=0; i<N; i++) Set(i, A[i]);
}
#include "Brunolib.h"

long long Bruno(int N, int A[]){
	long long ans=0;
	int t=0;
	for (int i=0; i<N; i+=3){
		if (A[i] && A[i+1] && A[i+2]) ans|=(1ll<<t), t++, ans|=(1ll<<t), t++;
		if (A[i] && A[i+1] && !A[i+2]) ans|=(1ll<<t), t++;
		if (A[i] && !A[i+1] && A[i+2]) ans|=(1ll<<t), t+=2;
		if (A[i] && !A[i+1] && !A[i+2]) t++;
		if (!A[i] && A[i+1] && A[i+2]) t+=2;
		if (!A[i] && A[i+1] && !A[i+2]) t++, ans|=(1ll<<t), t++;
		if (!A[i] && !A[i+1] && A[i+2]) ans|=(1ll<<t), t++;
	}
	return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:10:38: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    if ((X&(1ll<<cnt)) && (X&(1ll<<cnt+1))) A[i]=A[i+1]=A[i+2]=1;
                                   ~~~^~
Anna.cpp:11:39: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    if ((X&(1ll<<cnt)) && !(X&(1ll<<cnt+1))) A[i]=A[i+2]=1, A[i+1]=0;
                                    ~~~^~
Anna.cpp:12:39: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    if (!(X&(1ll<<cnt)) && (X&(1ll<<cnt+1))) A[i]=A[i+2]=0, A[i+1]=1;
                                    ~~~^~
Anna.cpp:13:40: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    if (!(X&(1ll<<cnt)) && !(X&(1ll<<cnt+1))) A[i+1]=A[i+2]=1, A[i]=0;
                                     ~~~^~
Anna.cpp:23:20: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     if (X&(1ll<<cnt+1)) A[i]=A[i+2]=0, A[i+1]=1;
                 ~~~^~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
2 Partially correct 61 ms 3056 KB Output isn't correct - L* = 0
3 Partially correct 63 ms 3008 KB Output isn't correct - L* = 0
4 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
5 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
6 Partially correct 48 ms 3056 KB Output isn't correct - L* = 0
7 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
8 Partially correct 43 ms 3072 KB Output isn't correct - L* = 0
9 Partially correct 54 ms 2992 KB Output isn't correct - L* = 0
10 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
11 Partially correct 40 ms 3056 KB Output isn't correct - L* = 0
12 Partially correct 42 ms 3056 KB Output isn't correct - L* = 0
13 Partially correct 42 ms 3328 KB Output isn't correct - L* = 0
14 Partially correct 41 ms 3056 KB Output isn't correct - L* = 0
15 Partially correct 45 ms 3056 KB Output isn't correct - L* = 0
16 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
17 Partially correct 41 ms 3056 KB Output isn't correct - L* = 0
18 Partially correct 41 ms 3056 KB Output isn't correct - L* = 0
19 Partially correct 41 ms 3056 KB Output isn't correct - L* = 0
20 Partially correct 42 ms 3072 KB Output isn't correct - L* = 0
21 Partially correct 40 ms 3056 KB Output isn't correct - L* = 0
22 Partially correct 43 ms 3072 KB Output isn't correct - L* = 0
23 Partially correct 40 ms 3056 KB Output isn't correct - L* = 0
24 Partially correct 41 ms 3056 KB Output isn't correct - L* = 0
25 Partially correct 41 ms 3056 KB Output isn't correct - L* = 0
26 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
27 Partially correct 40 ms 3072 KB Output isn't correct - L* = 0
28 Partially correct 40 ms 3072 KB Output isn't correct - L* = 0
29 Partially correct 42 ms 3072 KB Output isn't correct - L* = 0
30 Partially correct 42 ms 3072 KB Output isn't correct - L* = 0
31 Partially correct 40 ms 3072 KB Output isn't correct - L* = 0
32 Partially correct 41 ms 3136 KB Output isn't correct - L* = 0
33 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
34 Partially correct 43 ms 2880 KB Output isn't correct - L* = 0
35 Partially correct 44 ms 3120 KB Output isn't correct - L* = 0
36 Partially correct 44 ms 3056 KB Output isn't correct - L* = 0
37 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
38 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
39 Partially correct 41 ms 3072 KB Output isn't correct - L* = 0
40 Partially correct 44 ms 2880 KB Output isn't correct - L* = 0