답안 #468700

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
468700 2021-08-29T11:57:20 Z Omegaman Broken Device (JOI17_broken_device) C++14
0 / 100
127 ms 262148 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 XLen = int(log2(X) + 0.5);

	bool XArr[XLen];

	long long x = X;
	for( int i = 0; i < XLen; i++ ){
		XArr[i] = x%2;	
		x /= 2;
	}
	
	bool M[N];

	for( int i = 0; i < N; i += 7){
		const int j = (i/7)*4;
		const bool d1 = ((j+0) < XLen) ? XArr[j + 0] : 0;
		const bool d2 = ((j+1) < XLen) ? XArr[j + 1] : 0;
		const bool d3 = ((j+2) < XLen) ? XArr[j + 2] : 0;
		const bool d4 = ((j+3) < XLen) ? XArr[j + 3] : 0;
		const bool p1 = (d1+d2+d4) % 2;
		const bool p2 = (d1+d3+d4) % 2;
		const bool p3 = (d3+d2+d4) % 2;

		M[i + 0] = p1;
		M[i + 1] = p2;
		M[i + 2] = d1;
		M[i + 3] = p3;
		M[i + 4] = d2;
		M[i + 5] = d3;
		M[i + 6] = d4;
	}


	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 MLen = int((double)N/7.0*4);

	int M[MLen];

	for( int i = 0; i < N; i += 7){
		int j = i/7*4;
		bool p1 = A[i + 0];
		bool p2 = A[i + 1];
		bool d1 = A[i + 2];
		bool p3 = A[i + 3];
		bool d2 = A[i + 4];
		bool d3 = A[i + 5];
		bool d4 = A[i + 6];

		const int e1 = (p1+d1+d2+d4) % 2;
		const int e2 = (p2+d1+d3+d4) % 2;
		const int e3 = (p3+d3+d2+d4) % 2;

		const int e = e1+e2*2+e3*4;

		if(e == 3) d1 = !d1;
		if(e == 5) d2 = !d2;
		if(e == 6) d3 = !d3;
		if(e == 7) d4 = !d4;

		M[j + 0] = d1;
		M[j + 1] = d2;
		M[j + 2] = d3;
		M[j + 3] = d4;
	}

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

	return X;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 113 ms 262148 KB Execution killed with signal 9
2 Runtime error 118 ms 262148 KB Execution killed with signal 9
3 Runtime error 115 ms 262148 KB Execution killed with signal 9
4 Runtime error 117 ms 262148 KB Execution killed with signal 9
5 Runtime error 111 ms 262148 KB Execution killed with signal 9
6 Runtime error 111 ms 262148 KB Execution killed with signal 9
7 Runtime error 114 ms 262148 KB Execution killed with signal 9
8 Runtime error 119 ms 262148 KB Execution killed with signal 9
9 Runtime error 115 ms 262148 KB Execution killed with signal 9
10 Runtime error 120 ms 262148 KB Execution killed with signal 9
11 Runtime error 116 ms 262148 KB Execution killed with signal 9
12 Runtime error 119 ms 262148 KB Execution killed with signal 9
13 Runtime error 112 ms 262148 KB Execution killed with signal 9
14 Runtime error 110 ms 262148 KB Execution killed with signal 9
15 Runtime error 117 ms 262148 KB Execution killed with signal 9
16 Runtime error 114 ms 262148 KB Execution killed with signal 9
17 Runtime error 116 ms 262148 KB Execution killed with signal 9
18 Runtime error 114 ms 262148 KB Execution killed with signal 9
19 Runtime error 117 ms 262148 KB Execution killed with signal 9
20 Runtime error 112 ms 262148 KB Execution killed with signal 9
21 Runtime error 114 ms 262148 KB Execution killed with signal 9
22 Runtime error 112 ms 262148 KB Execution killed with signal 9
23 Runtime error 117 ms 262148 KB Execution killed with signal 9
24 Runtime error 116 ms 262148 KB Execution killed with signal 9
25 Runtime error 119 ms 262148 KB Execution killed with signal 9
26 Runtime error 119 ms 262148 KB Execution killed with signal 9
27 Runtime error 116 ms 262148 KB Execution killed with signal 9
28 Runtime error 112 ms 262148 KB Execution killed with signal 9
29 Runtime error 127 ms 262148 KB Execution killed with signal 9
30 Runtime error 114 ms 262148 KB Execution killed with signal 9
31 Runtime error 115 ms 262148 KB Execution killed with signal 9
32 Runtime error 114 ms 262148 KB Execution killed with signal 9
33 Runtime error 127 ms 262148 KB Execution killed with signal 9
34 Runtime error 113 ms 262148 KB Execution killed with signal 9
35 Runtime error 124 ms 262148 KB Execution killed with signal 9
36 Runtime error 114 ms 262148 KB Execution killed with signal 9
37 Runtime error 116 ms 262148 KB Execution killed with signal 9
38 Runtime error 116 ms 262148 KB Execution killed with signal 9
39 Runtime error 115 ms 262148 KB Execution killed with signal 9
40 Runtime error 111 ms 262148 KB Execution killed with signal 9