답안 #24868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24868 2017-06-16T12:30:16 Z khsoo01 Broken Device (JOI17_broken_device) C++11
0 / 100
0 ms 2836 KB
#include "Annalib.h"
typedef long long ll;
int br[155], cur;

int idx[9] = {7, 5, 4, 3, 6, 2, 1, 0};
int val[9] = {1, 3, 2, 0, 0, 1, 0, 0};
int mod[9] = {4, 4, 4, 4, 2, 2, 2, 1};

void Write (int X) {
	for(int i=2;i>=0;i--) {
		Set(cur+i, X%2);
		X /= 2;
	}
	cur += 3;
}

void Anna( int N, long long X, int K, int P[] ) {
	for(int i=0;i<N;i++) br[i] = 0;
	for(int i=0;i<K;i++) br[P[i]] = 1;
	for(int i=0;i<N;i+=3) {
		int cur = 4*br[i] + 2*br[i+1] + br[i+2];
		for(int j=0;j<8;j++) {
			if((cur&idx[j])==idx[j] && X%mod[j]==val[j]) {
				Write(idx[j]);
				X /= mod[j];
				break;
			}
		}
	}
}
#include "Brunolib.h"

int idx[9] = {7, 5, 4, 3, 6, 2, 1, 0};
int val[9] = {1, 3, 2, 0, 0, 1, 0, 0};
int mod[9] = {4, 4, 4, 4, 2, 2, 2, 1};

long long Bruno( int N, int A[] ){
	long long ans = 0;
	for(int i=N-3;i>=0;i-=3) {
		int cur = 4*A[i]+2*A[i+1]+A[i+2];
		for(int j=0;j<8;j++) {
			if(cur == idx[j]) {
				ans *= mod[j];
				ans += val[j];
			}
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2836 KB Wrong Answer [1]
2 Incorrect 0 ms 2836 KB Wrong Answer [1]
3 Incorrect 0 ms 2836 KB Wrong Answer [1]
4 Incorrect 0 ms 2836 KB Wrong Answer [1]
5 Incorrect 0 ms 2836 KB Wrong Answer [1]
6 Incorrect 0 ms 2836 KB Wrong Answer [1]
7 Incorrect 0 ms 2836 KB Wrong Answer [1]
8 Incorrect 0 ms 2836 KB Wrong Answer [1]
9 Incorrect 0 ms 2836 KB Wrong Answer [1]
10 Incorrect 0 ms 2836 KB Wrong Answer [1]
11 Incorrect 0 ms 2836 KB Wrong Answer [1]
12 Incorrect 0 ms 2836 KB Wrong Answer [1]
13 Incorrect 0 ms 2836 KB Wrong Answer [1]
14 Incorrect 0 ms 2836 KB Wrong Answer [1]
15 Incorrect 0 ms 2836 KB Wrong Answer [1]
16 Incorrect 0 ms 2836 KB Wrong Answer [1]
17 Incorrect 0 ms 2836 KB Wrong Answer [1]
18 Incorrect 0 ms 2836 KB Wrong Answer [1]
19 Incorrect 0 ms 2836 KB Wrong Answer [1]
20 Incorrect 0 ms 2836 KB Wrong Answer [1]
21 Incorrect 0 ms 2836 KB Wrong Answer [1]
22 Incorrect 0 ms 2836 KB Wrong Answer [1]
23 Incorrect 0 ms 2836 KB Wrong Answer [1]
24 Incorrect 0 ms 2836 KB Wrong Answer [1]
25 Incorrect 0 ms 2836 KB Wrong Answer [1]
26 Incorrect 0 ms 2836 KB Wrong Answer [1]
27 Incorrect 0 ms 2836 KB Wrong Answer [1]
28 Incorrect 0 ms 2836 KB Wrong Answer [1]
29 Incorrect 0 ms 2836 KB Wrong Answer [1]
30 Incorrect 0 ms 2836 KB Wrong Answer [1]
31 Incorrect 0 ms 2836 KB Wrong Answer [1]
32 Incorrect 0 ms 2836 KB Wrong Answer [1]
33 Incorrect 0 ms 2836 KB Wrong Answer [1]
34 Incorrect 0 ms 2836 KB Wrong Answer [1]
35 Incorrect 0 ms 2836 KB Wrong Answer [1]
36 Incorrect 0 ms 2836 KB Wrong Answer [1]
37 Incorrect 0 ms 2836 KB Wrong Answer [1]
38 Incorrect 0 ms 2836 KB Wrong Answer [1]
39 Incorrect 0 ms 2836 KB Wrong Answer [1]
40 Incorrect 0 ms 2836 KB Wrong Answer [1]