Submission #469988

# Submission time Handle Problem Language Result Execution time Memory
469988 2021-09-02T13:43:03 Z Omegaman Broken Device (JOI17_broken_device) C++14
0 / 100
45 ms 2368 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[]){
	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) {
			int broken = (int)!F[i+0] + (int)!F[i+1] + (int)!F[i+2];

			if (broken < 2) {
				//  [ 00 ]
				if ( !d[dh] && !d[dh+1] ) {
					if (F[i + 1] && F[i + 2] ) {
						m = 3;
						dh++;
					} else {
						m = 4;
					}
				}
				// [ 01 ]
				else if ( !d[dh] && d[dh+1] ) {
					if (F[i + 0] && F[i + 2] ) {
						m = 5;
						dh++;
					} else {
						m = 2;
					}
				}
				//  [ 10 ]
				else if ( d[dh] && !d[dh+1] ) {
					if (F[i + 0] && F[i + 1] ) {
						m = 6;
						dh++;
					} else {
						m = 1;
					}
				}
				//  [ 11 ]
				else if ( d[dh] && d[dh+1] ) {
					if (F[i + 0] && F[i + 1] && F[i + 2] ){
						m = 7;
						dh++;
					} else {
						m = 1;
					}
				}
				dh++;
			} else if ( broken < 3 ) {
				if ( d[dh] ) {
					if (F[i+2]) {
						m = 1;
						dh++;
					}
				} else {
					if (F[i+0]) {
						m = 4;
						dh++;
					}
					if (F[i+1]) {
						m = 2;
						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[] ) {
	long long X = 0;
	long long inc = 1;

	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) {
		int m = (int)A[i+0] * 4 + (int)A[i+1] * 2 + (int)A[i+2] * 1;
		switch (m) {
			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;
		}
	}

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

	return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 40 ms 2200 KB Output isn't correct - L* = 0
2 Partially correct 40 ms 2320 KB Output isn't correct - L* = 0
3 Partially correct 40 ms 2240 KB Output isn't correct - L* = 0
4 Partially correct 40 ms 2200 KB Output isn't correct - L* = 0
5 Partially correct 40 ms 2196 KB Output isn't correct - L* = 0
6 Partially correct 40 ms 2276 KB Output isn't correct - L* = 0
7 Partially correct 40 ms 2184 KB Output isn't correct - L* = 0
8 Partially correct 40 ms 2180 KB Output isn't correct - L* = 0
9 Partially correct 41 ms 2192 KB Output isn't correct - L* = 0
10 Partially correct 40 ms 2224 KB Output isn't correct - L* = 0
11 Partially correct 45 ms 2344 KB Output isn't correct - L* = 0
12 Partially correct 41 ms 2264 KB Output isn't correct - L* = 0
13 Partially correct 40 ms 2276 KB Output isn't correct - L* = 0
14 Partially correct 40 ms 2368 KB Output isn't correct - L* = 0
15 Partially correct 40 ms 2264 KB Output isn't correct - L* = 0
16 Partially correct 41 ms 2188 KB Output isn't correct - L* = 0
17 Partially correct 41 ms 2200 KB Output isn't correct - L* = 0
18 Partially correct 43 ms 2224 KB Output isn't correct - L* = 0
19 Partially correct 40 ms 2300 KB Output isn't correct - L* = 0
20 Partially correct 41 ms 2180 KB Output isn't correct - L* = 0
21 Partially correct 40 ms 2284 KB Output isn't correct - L* = 0
22 Partially correct 40 ms 2244 KB Output isn't correct - L* = 0
23 Partially correct 45 ms 2168 KB Output isn't correct - L* = 0
24 Partially correct 40 ms 2192 KB Output isn't correct - L* = 0
25 Partially correct 41 ms 2288 KB Output isn't correct - L* = 0
26 Partially correct 44 ms 2272 KB Output isn't correct - L* = 0
27 Partially correct 40 ms 2200 KB Output isn't correct - L* = 0
28 Partially correct 41 ms 2268 KB Output isn't correct - L* = 0
29 Partially correct 43 ms 2208 KB Output isn't correct - L* = 0
30 Partially correct 40 ms 2280 KB Output isn't correct - L* = 0
31 Partially correct 40 ms 2252 KB Output isn't correct - L* = 0
32 Partially correct 43 ms 2232 KB Output isn't correct - L* = 0
33 Partially correct 41 ms 2220 KB Output isn't correct - L* = 0
34 Partially correct 40 ms 2328 KB Output isn't correct - L* = 0
35 Partially correct 43 ms 2168 KB Output isn't correct - L* = 0
36 Partially correct 41 ms 2248 KB Output isn't correct - L* = 0
37 Partially correct 41 ms 2208 KB Output isn't correct - L* = 0
38 Partially correct 40 ms 2160 KB Output isn't correct - L* = 0
39 Partially correct 40 ms 2324 KB Output isn't correct - L* = 0
40 Partially correct 40 ms 2252 KB Output isn't correct - L* = 0