Submission #468776

# Submission time Handle Problem Language Result Execution time Memory
468776 2021-08-29T15:00:49 Z Omegaman Broken Device (JOI17_broken_device) C++14
45 / 100
56 ms 2692 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+0.5)*3 &&
			F[i] &&
			(F[i + 1] == xa[j + 0] || F[i + 1]) &&
			(F[i + 2] == xa[j + 1] || F[i + 2]) &&
			(F[i + 3] == xa[j + 2] || F[i + 3])) {

			M[i + 0] =         1;
			M[i + 1] = xa[j + 0];
			M[i + 2] = xa[j + 1];
			M[i + 3] = xa[j + 2];
          
			j += 3;
			i += 3;
		} 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 += 3;
		}
	}
  
	bool M[len];

	int j = 0;
	for( int i = 0; i < N && j < len; i++){
		if (A[i]) {
			M[j + 0] = A[i + 1];
			M[j + 1] = A[i + 2];
			M[j + 2] = A[i + 3];
			i += 3;
			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 41 ms 2452 KB Output is partially correct - L* = 24
2 Partially correct 46 ms 2552 KB Output is partially correct - L* = 27
3 Partially correct 43 ms 2420 KB Output is partially correct - L* = 23
4 Partially correct 41 ms 2468 KB Output is partially correct - L* = 18
5 Partially correct 45 ms 2456 KB Output is partially correct - L* = 24
6 Partially correct 43 ms 2496 KB Output is partially correct - L* = 21
7 Partially correct 41 ms 2504 KB Output is partially correct - L* = 19
8 Partially correct 44 ms 2544 KB Output is partially correct - L* = 24
9 Partially correct 43 ms 2432 KB Output is partially correct - L* = 25
10 Partially correct 45 ms 2476 KB Output is partially correct - L* = 23
11 Partially correct 41 ms 2432 KB Output is partially correct - L* = 19
12 Partially correct 44 ms 2492 KB Output is partially correct - L* = 21
13 Partially correct 41 ms 2476 KB Output is partially correct - L* = 24
14 Partially correct 43 ms 2448 KB Output is partially correct - L* = 19
15 Partially correct 43 ms 2408 KB Output is partially correct - L* = 24
16 Partially correct 44 ms 2464 KB Output is partially correct - L* = 17
17 Partially correct 43 ms 2588 KB Output is partially correct - L* = 23
18 Partially correct 41 ms 2464 KB Output is partially correct - L* = 17
19 Partially correct 45 ms 2484 KB Output is partially correct - L* = 23
20 Partially correct 52 ms 2468 KB Output is partially correct - L* = 24
21 Partially correct 44 ms 2380 KB Output is partially correct - L* = 24
22 Partially correct 54 ms 2484 KB Output is partially correct - L* = 24
23 Partially correct 41 ms 2448 KB Output is partially correct - L* = 21
24 Partially correct 41 ms 2404 KB Output is partially correct - L* = 23
25 Partially correct 43 ms 2416 KB Output is partially correct - L* = 26
26 Partially correct 43 ms 2452 KB Output is partially correct - L* = 23
27 Partially correct 53 ms 2444 KB Output is partially correct - L* = 23
28 Partially correct 43 ms 2524 KB Output is partially correct - L* = 20
29 Partially correct 41 ms 2440 KB Output is partially correct - L* = 23
30 Partially correct 49 ms 2548 KB Output is partially correct - L* = 24
31 Partially correct 48 ms 2604 KB Output is partially correct - L* = 23
32 Partially correct 41 ms 2568 KB Output is partially correct - L* = 18
33 Partially correct 49 ms 2484 KB Output is partially correct - L* = 17
34 Partially correct 41 ms 2492 KB Output is partially correct - L* = 24
35 Partially correct 44 ms 2556 KB Output is partially correct - L* = 24
36 Partially correct 43 ms 2692 KB Output is partially correct - L* = 20
37 Partially correct 44 ms 2444 KB Output is partially correct - L* = 20
38 Partially correct 56 ms 2500 KB Output is partially correct - L* = 20
39 Partially correct 45 ms 2548 KB Output is partially correct - L* = 21
40 Partially correct 43 ms 2392 KB Output is partially correct - L* = 25