Submission #468829

# Submission time Handle Problem Language Result Execution time Memory
468829 2021-08-29T19:20:32 Z Omegaman Broken Device (JOI17_broken_device) C++14
8 / 100
45 ms 2584 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])) {
			
				M[i + 0] =			1;
				M[i + 1] =			0;
				M[i + 2] =	xa[j + 0];
				M[i + 3] =	xa[j + 1];

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


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

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

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

			i += 3;
			j += 2;
		}
	}

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

	return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 43 ms 2444 KB Output is partially correct - L* = 14
2 Partially correct 44 ms 2444 KB Output is partially correct - L* = 14
3 Partially correct 41 ms 2492 KB Output is partially correct - L* = 14
4 Partially correct 41 ms 2508 KB Output is partially correct - L* = 14
5 Partially correct 41 ms 2472 KB Output is partially correct - L* = 14
6 Partially correct 41 ms 2448 KB Output is partially correct - L* = 14
7 Partially correct 41 ms 2432 KB Output is partially correct - L* = 14
8 Partially correct 41 ms 2472 KB Output is partially correct - L* = 14
9 Partially correct 44 ms 2544 KB Output is partially correct - L* = 14
10 Partially correct 41 ms 2444 KB Output is partially correct - L* = 14
11 Partially correct 41 ms 2532 KB Output is partially correct - L* = 14
12 Partially correct 43 ms 2520 KB Output is partially correct - L* = 14
13 Partially correct 43 ms 2412 KB Output is partially correct - L* = 14
14 Partially correct 41 ms 2504 KB Output is partially correct - L* = 14
15 Partially correct 43 ms 2440 KB Output is partially correct - L* = 14
16 Partially correct 41 ms 2584 KB Output is partially correct - L* = 14
17 Partially correct 41 ms 2440 KB Output is partially correct - L* = 14
18 Partially correct 43 ms 2532 KB Output is partially correct - L* = 14
19 Partially correct 41 ms 2464 KB Output is partially correct - L* = 14
20 Partially correct 45 ms 2568 KB Output is partially correct - L* = 14
21 Partially correct 45 ms 2516 KB Output is partially correct - L* = 14
22 Partially correct 40 ms 2420 KB Output is partially correct - L* = 14
23 Partially correct 40 ms 2476 KB Output is partially correct - L* = 14
24 Partially correct 43 ms 2548 KB Output is partially correct - L* = 15
25 Partially correct 41 ms 2512 KB Output is partially correct - L* = 14
26 Partially correct 44 ms 2488 KB Output is partially correct - L* = 14
27 Partially correct 43 ms 2452 KB Output is partially correct - L* = 14
28 Partially correct 41 ms 2452 KB Output is partially correct - L* = 14
29 Partially correct 44 ms 2484 KB Output is partially correct - L* = 14
30 Partially correct 41 ms 2436 KB Output is partially correct - L* = 14
31 Partially correct 40 ms 2404 KB Output is partially correct - L* = 14
32 Partially correct 41 ms 2536 KB Output is partially correct - L* = 14
33 Partially correct 41 ms 2512 KB Output is partially correct - L* = 14
34 Partially correct 41 ms 2372 KB Output is partially correct - L* = 14
35 Partially correct 41 ms 2564 KB Output is partially correct - L* = 14
36 Partially correct 44 ms 2556 KB Output is partially correct - L* = 14
37 Partially correct 41 ms 2520 KB Output is partially correct - L* = 14
38 Partially correct 43 ms 2460 KB Output is partially correct - L* = 14
39 Partially correct 40 ms 2440 KB Output is partially correct - L* = 14
40 Partially correct 40 ms 2544 KB Output is partially correct - L* = 14