답안 #468837

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
468837 2021-08-29T19:42:03 Z Omegaman Broken Device (JOI17_broken_device) C++14
49 / 100
48 ms 2320 KB
#include "Annalib.h"
#include <math.h>

bool isInArr(int ArrLen, int Arr[], int val) {
	for ( int i = 0; i < ArrLen; i++ )
		if (Arr[i] == val)
			return true;
	return false;
}

void Anna(int N, long long X, int K, int P[]){
	const int xl = int(log2(X) + 0.5);

	bool xa[N];
	long long x = X;
	for( int i = 0; i < N; i++ ){
		xa[i] = x % 2;
		x /= 2;
	}

	bool F[N];

	for ( int i = 0; i < N; i++ ) {
		F[i] = !isInArr(K, P, i);
	}
	
	bool M[N];

	int j = 0;
	for( int i = 0; i < N; i++){
		if (j < (xl/4+1)*4 &&
			F[i]){
			if(	(F[i + 2] == xa[j + 0] || F[i + 2]) &&
				(F[i + 3] == xa[j + 1] || F[i + 3]) &&
				(F[i + 4] == xa[j + 2] || F[i + 4]) &&
				(F[i + 5] == xa[j + 3] || F[i + 5])) {
			
				M[i + 0] =			1;
				M[i + 1] =			0;
				M[i + 2] =	xa[j + 0];
				M[i + 3] =	xa[j + 1];
				M[i + 4] =	xa[j + 2];
				M[i + 5] =	xa[j + 3];

				j += 4;
				i += 5;
			} else if (
				F[i+1] &&
				(F[i + 2] == !xa[j + 0] || F[i + 2]) &&
				(F[i + 3] == !xa[j + 1] || F[i + 3]) &&
				(F[i + 4] == !xa[j + 2] || F[i + 4]) &&
				(F[i + 5] == !xa[j + 3] || F[i + 5])) {

				M[i + 0] =			1;
				M[i + 1] =			1;
				M[i + 2] =	!xa[j + 0];
				M[i + 3] =	!xa[j + 1];
				M[i + 4] =	!xa[j + 2];
				M[i + 5] =	!xa[j + 3];

				j += 4;
				i += 5;
			} else {
				M[i] = 0;
			}
		} else {
			M[i] = 0;
		}
	}

	for ( int i = 0; i < N; i++ ) {
		Set(i, (int)M[i]);
	}
}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
	long long X = 0;
	long long inc = 1;

	int len = 0;

	for( int i = 0; i < N; i++){
		if (A[i]) {
			len += 4;
			i += 5;
		}
	}

	bool M[len];

	int j = 0;
	for( int i = 0; i < N-3 && j < len; i++){
		if (A[i]) {
			M[j + 0] = A[i + 2] ^ A[i + 1];
			M[j + 1] = A[i + 3] ^ A[i + 1];
			M[j + 2] = A[i + 4] ^ A[i + 1];
			M[j + 3] = A[i + 5] ^ A[i + 1];
          
			i += 5;
			j += 4;
		}
	}

	for (int i = 0; i < len; i++) {
		X += inc * M[i];
		inc *= 2;
	}
  
	return X;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 44 ms 2192 KB Output is partially correct - L* = 20
2 Partially correct 40 ms 2192 KB Output is partially correct - L* = 22
3 Partially correct 41 ms 2236 KB Output is partially correct - L* = 21
4 Partially correct 40 ms 2220 KB Output is partially correct - L* = 23
5 Partially correct 41 ms 2240 KB Output is partially correct - L* = 22
6 Partially correct 40 ms 2240 KB Output is partially correct - L* = 24
7 Partially correct 41 ms 2200 KB Output is partially correct - L* = 23
8 Partially correct 40 ms 2300 KB Output is partially correct - L* = 21
9 Partially correct 40 ms 2260 KB Output is partially correct - L* = 22
10 Partially correct 40 ms 2224 KB Output is partially correct - L* = 24
11 Partially correct 40 ms 2148 KB Output is partially correct - L* = 22
12 Partially correct 43 ms 2244 KB Output is partially correct - L* = 24
13 Partially correct 40 ms 2284 KB Output is partially correct - L* = 23
14 Partially correct 41 ms 2224 KB Output is partially correct - L* = 22
15 Partially correct 41 ms 2260 KB Output is partially correct - L* = 23
16 Partially correct 40 ms 2216 KB Output is partially correct - L* = 25
17 Partially correct 46 ms 2220 KB Output is partially correct - L* = 21
18 Partially correct 40 ms 2196 KB Output is partially correct - L* = 23
19 Partially correct 41 ms 2192 KB Output is partially correct - L* = 19
20 Partially correct 40 ms 2220 KB Output is partially correct - L* = 21
21 Partially correct 40 ms 2252 KB Output is partially correct - L* = 22
22 Partially correct 40 ms 2216 KB Output is partially correct - L* = 22
23 Partially correct 40 ms 2240 KB Output is partially correct - L* = 23
24 Partially correct 43 ms 2208 KB Output is partially correct - L* = 23
25 Partially correct 43 ms 2248 KB Output is partially correct - L* = 21
26 Partially correct 41 ms 2260 KB Output is partially correct - L* = 22
27 Partially correct 48 ms 2176 KB Output is partially correct - L* = 19
28 Partially correct 40 ms 2228 KB Output is partially correct - L* = 21
29 Partially correct 46 ms 2224 KB Output is partially correct - L* = 26
30 Partially correct 40 ms 2208 KB Output is partially correct - L* = 23
31 Partially correct 40 ms 2320 KB Output is partially correct - L* = 24
32 Partially correct 41 ms 2264 KB Output is partially correct - L* = 22
33 Partially correct 40 ms 2212 KB Output is partially correct - L* = 21
34 Partially correct 41 ms 2200 KB Output is partially correct - L* = 24
35 Partially correct 47 ms 2200 KB Output is partially correct - L* = 21
36 Partially correct 43 ms 2284 KB Output is partially correct - L* = 22
37 Partially correct 40 ms 2268 KB Output is partially correct - L* = 22
38 Partially correct 43 ms 2256 KB Output is partially correct - L* = 25
39 Partially correct 40 ms 2192 KB Output is partially correct - L* = 22
40 Partially correct 40 ms 2288 KB Output is partially correct - L* = 21