Submission #470059

# Submission time Handle Problem Language Result Execution time Memory
470059 2021-09-02T19:32:30 Z Omegaman Broken Device (JOI17_broken_device) C++14
0 / 100
45 ms 2732 KB
#include "Annalib.h"
#include <math.h>
 
 
bool isInArr(int ArrLen, int Arr[], int val) {
	for (int i = -1; ++i < ArrLen;)
		if (Arr[i] == val) return 1;
	return 0;
}
 
void Anna(int N, long long X, int K, int P[]){
	bool d[N];
	long long x = X;
	for( int i = 0; i < N; i++ ){
		d[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 dh = 0;
	for( int i = 0; i < N; i+=3) {
		int m = 0;
		if (dh < 60) {
			const bool	d1 = d[dh + 0],
						d2 = d[dh + 1],

						f1 = F[i  + 0],
						f2 = F[i  + 1],
						f3 = F[i  + 2]; 

			int broken = !f1 + !f2 + !f3;

			if (broken < 2) { if (0) return; else 
				if ( !d1 && !d2 )	m = (      f2 && f3) ? 3 : 4; else 
				if ( !d1 &&  d2 )	m = (f1       && f3) ? 5 : 2; else
				if (  d1 && !d2 )	m = (f1 && f2      ) ? 6 : 1; else
				if (  d1 &&  d2 )	m = (f1 && f2 && f3) ? 7 : 1;
			} else if ( broken == 2 ) {
				if ( d1)
					if (f3) m = 1;
				if (!d1) {
					if (f1) m = 4;
					if (f2) m = 2;
				}
			}
		}

		if(m) dh++;
		if(m>4||m==3) dh++;
 
		M[i + 2] = m % 2; m /= 2;
		M[i + 1] = m % 2; m /= 2;
		M[i + 0] = m % 2;
	}
 
	for ( int i = 0; i < N; i++ ) {
		Set(i, (int)M[i]);
	}
}
#include "Brunolib.h"
 
long long Bruno( int N, int A[] ) {
 	int len = (N < 60 ? N : 60);
 
	bool d[len];
	for(int i = 0; i < len; i++) d[i] = 0;
 
	int dh = 0;
	for(int i = 0; i < N; i+=3) {
		switch ((int)A[i] * 4 + (int)A[i+1] * 2 + (int)A[i+2]) {
			case 0:
				break;
			case 1:
				d[dh++] = 1;
				break;
			case 2:
				d[dh++] = 0;
				break;
			case 3:
				d[dh++] = 0;
				d[dh++] = 0;
				break;
			case 4:
				d[dh++] = 0;
				break;
			case 5:
				d[dh++] = 0;
				d[dh++] = 1;
				break;
			case 6:
				d[dh++] = 1;
				d[dh++] = 0;
				break;
			case 7:
				d[dh++] = 1;
				d[dh++] = 1;
				break;
		}
	}
 
	long long X = 0;
	long long inc = 1;
	for (int i = 0; i < len; i++) {
		X += inc * d[i];
		inc *= 2;
	}
 
	return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 41 ms 2524 KB Output isn't correct - L* = 0
2 Partially correct 40 ms 2404 KB Output isn't correct - L* = 0
3 Partially correct 40 ms 2456 KB Output isn't correct - L* = 0
4 Partially correct 40 ms 2480 KB Output isn't correct - L* = 0
5 Partially correct 40 ms 2444 KB Output isn't correct - L* = 0
6 Partially correct 40 ms 2480 KB Output isn't correct - L* = 0
7 Partially correct 40 ms 2460 KB Output isn't correct - L* = 0
8 Partially correct 40 ms 2448 KB Output isn't correct - L* = 0
9 Partially correct 41 ms 2732 KB Output isn't correct - L* = 0
10 Partially correct 41 ms 2440 KB Output isn't correct - L* = 0
11 Partially correct 40 ms 2548 KB Output isn't correct - L* = 0
12 Partially correct 40 ms 2452 KB Output isn't correct - L* = 0
13 Partially correct 41 ms 2552 KB Output isn't correct - L* = 0
14 Partially correct 40 ms 2536 KB Output isn't correct - L* = 0
15 Partially correct 40 ms 2476 KB Output isn't correct - L* = 0
16 Partially correct 40 ms 2492 KB Output isn't correct - L* = 0
17 Partially correct 44 ms 2396 KB Output isn't correct - L* = 0
18 Partially correct 40 ms 2448 KB Output isn't correct - L* = 0
19 Partially correct 40 ms 2408 KB Output isn't correct - L* = 0
20 Partially correct 40 ms 2444 KB Output isn't correct - L* = 0
21 Partially correct 40 ms 2456 KB Output isn't correct - L* = 0
22 Partially correct 41 ms 2480 KB Output isn't correct - L* = 0
23 Partially correct 40 ms 2396 KB Output isn't correct - L* = 0
24 Partially correct 43 ms 2640 KB Output isn't correct - L* = 0
25 Partially correct 40 ms 2436 KB Output isn't correct - L* = 0
26 Partially correct 41 ms 2476 KB Output isn't correct - L* = 0
27 Partially correct 40 ms 2444 KB Output isn't correct - L* = 0
28 Partially correct 43 ms 2448 KB Output isn't correct - L* = 0
29 Partially correct 40 ms 2472 KB Output isn't correct - L* = 0
30 Partially correct 40 ms 2488 KB Output isn't correct - L* = 0
31 Partially correct 43 ms 2440 KB Output isn't correct - L* = 0
32 Partially correct 45 ms 2452 KB Output isn't correct - L* = 0
33 Partially correct 41 ms 2492 KB Output isn't correct - L* = 0
34 Partially correct 41 ms 2444 KB Output isn't correct - L* = 0
35 Partially correct 40 ms 2444 KB Output isn't correct - L* = 0
36 Partially correct 40 ms 2524 KB Output isn't correct - L* = 0
37 Partially correct 40 ms 2444 KB Output isn't correct - L* = 0
38 Partially correct 40 ms 2428 KB Output isn't correct - L* = 0
39 Partially correct 40 ms 2392 KB Output isn't correct - L* = 0
40 Partially correct 40 ms 2456 KB Output isn't correct - L* = 0