Submission #468835

# Submission time Handle Problem Language Result Execution time Memory
468835 2021-08-29T19:36:58 Z Omegaman Broken Device (JOI17_broken_device) C++14
63 / 100
43 ms 2380 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/3+1)*3 &&
			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])) {
			
				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];

				j += 3;
				i += 4;
			} 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])) {

				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];

				j += 3;
				i += 4;
			} 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 += 3;
			i += 4;
		}
	}

	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];
          
			i += 4;
			j += 3;
		}
	}

	for (int i = 0; i < len; i++) {
		X += inc * M[i];
		inc *= 2;
	}

	return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 40 ms 2228 KB Output is partially correct - L* = 29
2 Partially correct 40 ms 2196 KB Output is partially correct - L* = 30
3 Partially correct 40 ms 2300 KB Output is partially correct - L* = 26
4 Partially correct 41 ms 2248 KB Output is partially correct - L* = 29
5 Partially correct 40 ms 2200 KB Output is partially correct - L* = 33
6 Partially correct 41 ms 2380 KB Output is partially correct - L* = 30
7 Partially correct 40 ms 2200 KB Output is partially correct - L* = 29
8 Partially correct 40 ms 2248 KB Output is partially correct - L* = 27
9 Partially correct 41 ms 2240 KB Output is partially correct - L* = 27
10 Partially correct 40 ms 2220 KB Output is partially correct - L* = 28
11 Partially correct 40 ms 2268 KB Output is partially correct - L* = 27
12 Partially correct 40 ms 2252 KB Output is partially correct - L* = 28
13 Partially correct 40 ms 2176 KB Output is partially correct - L* = 29
14 Partially correct 43 ms 2248 KB Output is partially correct - L* = 26
15 Partially correct 41 ms 2192 KB Output is partially correct - L* = 26
16 Partially correct 40 ms 2212 KB Output is partially correct - L* = 28
17 Partially correct 40 ms 2176 KB Output is partially correct - L* = 29
18 Partially correct 40 ms 2316 KB Output is partially correct - L* = 30
19 Partially correct 40 ms 2192 KB Output is partially correct - L* = 27
20 Partially correct 43 ms 2328 KB Output is partially correct - L* = 26
21 Partially correct 40 ms 2248 KB Output is partially correct - L* = 30
22 Partially correct 40 ms 2192 KB Output is partially correct - L* = 29
23 Partially correct 40 ms 2244 KB Output is partially correct - L* = 28
24 Partially correct 40 ms 2276 KB Output is partially correct - L* = 28
25 Partially correct 40 ms 2320 KB Output is partially correct - L* = 27
26 Partially correct 40 ms 2236 KB Output is partially correct - L* = 27
27 Partially correct 41 ms 2284 KB Output is partially correct - L* = 28
28 Partially correct 41 ms 2328 KB Output is partially correct - L* = 30
29 Partially correct 41 ms 2220 KB Output is partially correct - L* = 27
30 Partially correct 40 ms 2160 KB Output is partially correct - L* = 30
31 Partially correct 40 ms 2344 KB Output is partially correct - L* = 32
32 Partially correct 40 ms 2188 KB Output is partially correct - L* = 29
33 Partially correct 40 ms 2244 KB Output is partially correct - L* = 26
34 Partially correct 40 ms 2184 KB Output is partially correct - L* = 29
35 Partially correct 43 ms 2280 KB Output is partially correct - L* = 28
36 Partially correct 40 ms 2236 KB Output is partially correct - L* = 29
37 Partially correct 43 ms 2224 KB Output is partially correct - L* = 27
38 Partially correct 41 ms 2260 KB Output is partially correct - L* = 28
39 Partially correct 43 ms 2192 KB Output is partially correct - L* = 30
40 Partially correct 41 ms 2340 KB Output is partially correct - L* = 28