답안 #470072

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470072 2021-09-02T21:41:13 Z Omegaman Broken Device (JOI17_broken_device) C++14
0 / 100
55 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 1;
	return 0;
}
 
void Anna(int N, long long X, int K, int P[]){
	bool d[N], F[N];
	long long x = X;
	for( int i = 0; i < N; i++ ){
		d[i] = x % 2;
		x /= 2;
		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 = dh < 59 ? d[dh + 1] : 0,

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

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

			if (broken < 2 && dh < 59) { 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;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 43 ms 2228 KB Output isn't correct - L* = 0
2 Partially correct 41 ms 2252 KB Output isn't correct - L* = 0
3 Partially correct 41 ms 2380 KB Output isn't correct - L* = 0
4 Partially correct 41 ms 2312 KB Output isn't correct - L* = 0
5 Partially correct 41 ms 2196 KB Output isn't correct - L* = 0
6 Partially correct 48 ms 2200 KB Output isn't correct - L* = 0
7 Partially correct 43 ms 2228 KB Output isn't correct - L* = 0
8 Partially correct 43 ms 2176 KB Output isn't correct - L* = 0
9 Partially correct 41 ms 2184 KB Output isn't correct - L* = 0
10 Partially correct 41 ms 2268 KB Output isn't correct - L* = 0
11 Partially correct 41 ms 2196 KB Output isn't correct - L* = 0
12 Partially correct 54 ms 2180 KB Output isn't correct - L* = 0
13 Partially correct 52 ms 2236 KB Output isn't correct - L* = 0
14 Partially correct 41 ms 2192 KB Output isn't correct - L* = 0
15 Partially correct 41 ms 2260 KB Output isn't correct - L* = 0
16 Partially correct 43 ms 2288 KB Output isn't correct - L* = 0
17 Partially correct 41 ms 2152 KB Output isn't correct - L* = 0
18 Partially correct 44 ms 2240 KB Output isn't correct - L* = 0
19 Partially correct 45 ms 2196 KB Output isn't correct - L* = 0
20 Partially correct 55 ms 2196 KB Output isn't correct - L* = 0
21 Partially correct 47 ms 2284 KB Output isn't correct - L* = 0
22 Partially correct 41 ms 2344 KB Output isn't correct - L* = 0
23 Partially correct 41 ms 2200 KB Output isn't correct - L* = 0
24 Partially correct 41 ms 2196 KB Output isn't correct - L* = 0
25 Partially correct 46 ms 2244 KB Output isn't correct - L* = 0
26 Partially correct 48 ms 2248 KB Output isn't correct - L* = 0
27 Partially correct 41 ms 2200 KB Output isn't correct - L* = 0
28 Partially correct 41 ms 2184 KB Output isn't correct - L* = 0
29 Partially correct 41 ms 2288 KB Output isn't correct - L* = 0
30 Partially correct 41 ms 2328 KB Output isn't correct - L* = 0
31 Partially correct 41 ms 2340 KB Output isn't correct - L* = 0
32 Partially correct 41 ms 2236 KB Output isn't correct - L* = 0
33 Partially correct 41 ms 2264 KB Output isn't correct - L* = 0
34 Partially correct 41 ms 2192 KB Output isn't correct - L* = 0
35 Partially correct 43 ms 2164 KB Output isn't correct - L* = 0
36 Partially correct 41 ms 2192 KB Output isn't correct - L* = 0
37 Partially correct 41 ms 2240 KB Output isn't correct - L* = 0
38 Partially correct 41 ms 2248 KB Output isn't correct - L* = 0
39 Partially correct 41 ms 2292 KB Output isn't correct - L* = 0
40 Partially correct 44 ms 2220 KB Output isn't correct - L* = 0