답안 #24871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24871 2017-06-16T12:36:51 Z khsoo01 Broken Device (JOI17_broken_device) C++11
51 / 100
62 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;
	cur = 0;
	for(int i=0;i<N;i+=3) {
		int tmp = 7 - (4*br[i] + 2*br[i+1] + br[i+2]);
		for(int j=0;j<8;j++) {
			if((tmp&idx[j])==idx[j] && X%mod[j]==val[j]) {
				Write(idx[j]);
				X /= 1ll*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 *= 1ll*mod[j];
				ans += 1ll*val[j];
			}
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 48 ms 2836 KB Output is partially correct - L* = 23
2 Partially correct 36 ms 2836 KB Output is partially correct - L* = 28
3 Partially correct 52 ms 2836 KB Output is partially correct - L* = 27
4 Partially correct 52 ms 2836 KB Output is partially correct - L* = 23
5 Partially correct 41 ms 2836 KB Output is partially correct - L* = 22
6 Partially correct 32 ms 2836 KB Output is partially correct - L* = 20
7 Partially correct 62 ms 2836 KB Output is partially correct - L* = 24
8 Partially correct 41 ms 2836 KB Output is partially correct - L* = 26
9 Partially correct 41 ms 2836 KB Output is partially correct - L* = 22
10 Partially correct 39 ms 2836 KB Output is partially correct - L* = 24
11 Partially correct 45 ms 2836 KB Output is partially correct - L* = 34
12 Partially correct 41 ms 2836 KB Output is partially correct - L* = 28
13 Partially correct 39 ms 2836 KB Output is partially correct - L* = 23
14 Partially correct 55 ms 2836 KB Output is partially correct - L* = 20
15 Partially correct 45 ms 2836 KB Output is partially correct - L* = 20
16 Partially correct 41 ms 2836 KB Output is partially correct - L* = 22
17 Partially correct 25 ms 2836 KB Output is partially correct - L* = 20
18 Partially correct 48 ms 2836 KB Output is partially correct - L* = 24
19 Partially correct 45 ms 2836 KB Output is partially correct - L* = 23
20 Partially correct 42 ms 2836 KB Output is partially correct - L* = 26
21 Partially correct 52 ms 2836 KB Output is partially correct - L* = 27
22 Partially correct 39 ms 2836 KB Output is partially correct - L* = 20
23 Partially correct 49 ms 2836 KB Output is partially correct - L* = 21
24 Partially correct 41 ms 2836 KB Output is partially correct - L* = 26
25 Partially correct 46 ms 2836 KB Output is partially correct - L* = 22
26 Partially correct 28 ms 2836 KB Output is partially correct - L* = 21
27 Partially correct 45 ms 2836 KB Output is partially correct - L* = 24
28 Partially correct 46 ms 2836 KB Output is partially correct - L* = 21
29 Partially correct 52 ms 2836 KB Output is partially correct - L* = 29
30 Partially correct 52 ms 2836 KB Output is partially correct - L* = 21
31 Partially correct 52 ms 2836 KB Output is partially correct - L* = 28
32 Partially correct 41 ms 2836 KB Output is partially correct - L* = 30
33 Partially correct 52 ms 2836 KB Output is partially correct - L* = 31
34 Partially correct 59 ms 2836 KB Output is partially correct - L* = 22
35 Partially correct 38 ms 2836 KB Output is partially correct - L* = 20
36 Partially correct 41 ms 2836 KB Output is partially correct - L* = 28
37 Partially correct 45 ms 2836 KB Output is partially correct - L* = 20
38 Partially correct 52 ms 2836 KB Output is partially correct - L* = 22
39 Partially correct 41 ms 2836 KB Output is partially correct - L* = 22
40 Partially correct 41 ms 2836 KB Output is partially correct - L* = 22