답안 #97558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97558 2019-02-17T03:44:52 Z shoemakerjo Broken Device (JOI17_broken_device) C++14
0 / 100
68 ms 3328 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;

bool marked[200];

void Anna( int N, ll X, int K, int P[] ){
	for (int i = 0; i < N; i++) marked[i] = false;

	for (int i = 0; i < K; i++) {
		marked[P[i]] = true;
	}

	int a, b, c;
	for (int i = 0; i < N; i += 3) {
		a = i; b = i+1; c = i+2;
		int ct = 0;
		if (marked[a]) ct++;
		if (marked[b]) ct++;
		if (marked[c]) ct++;
		if (ct >= 2) {
			Set(a, 0); Set(b, 0); Set(c, 1);
			continue;
		}
		if (ct == 0) {
			//set all to 1 for a 1 bit

			if (X % 4 == 0) {
				Set(a, 0); Set(b, 1); Set(c, 1);
			}
			if (X % 4 == 2) {
				Set(a, 0); Set(b, 1); Set(c, 0);
			}	
			if (X % 4 == 1) {
				Set(a, 1); Set(b, 0); Set(c, 1);
			}
			if (X % 4 == 3) {
				Set(a, 1); Set(b, 1); Set(c, 1);
			}
			X /= 4;

		}
		if (ct == 1) {
			if (X % 2 == 0) {
				if (marked[a]) {
					if (X % 4 == 0) {
						Set(a, 0); Set(b, 1); Set(c, 1);
					}
					else {
						Set(a, 0); Set(b, 1); Set(c, 0);
					}
					X/=4;
				}
				else {
					Set(a, 1); Set(b, 0); Set(c, 0);
					X /= 2;
				}
			}
			else {
				if (marked[c]) {
					Set(a, 1); Set(b, 1); Set(c, 0);
				}
				else {
					Set(a, 0); Set(b, 0); Set(c, 1);
				}
				X /= 2;
			}

		}
	}

}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;
#define ll long long

ll Bruno( int N, int A[] ){
	ll res = 0;
	for (int i = N-1; i > 0; i -= 3) {
		int a = i-2;
		int b = i-1;
		int c = i;

		if (A[a] == 0 && A[b] == 0 && A[c] == 0) continue;

		int cv = (A[c] == 0) + 2*(A[b] == 1) + 4*(A[a] == 0);

		if (cv == 1) {
			res = res * 2 + 1;
		}
		if (cv == 2) {
			res = res * 4 + 2;
		}
		if (cv == 3) {
			res = res * 4 + 0;
		}
		if (cv == 4) {
			res = res * 2 + 0;
		}
		if (cv == 5) {
			res = res * 4 + 1;
		}
		if (cv == 6) {
			res = res * 2 + 1;
		}
		if (cv == 7) {
			res = res * 4 + 3;
		}
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 3056 KB Output isn't correct - L* = 0
2 Incorrect 50 ms 3056 KB Output isn't correct - L* = 0
3 Incorrect 47 ms 3328 KB Output isn't correct - L* = 0
4 Incorrect 55 ms 3056 KB Output isn't correct - L* = 0
5 Incorrect 51 ms 3064 KB Output isn't correct - L* = 0
6 Incorrect 43 ms 3072 KB Output isn't correct - L* = 0
7 Incorrect 49 ms 3032 KB Output isn't correct - L* = 0
8 Incorrect 54 ms 3056 KB Output isn't correct - L* = 0
9 Incorrect 62 ms 3056 KB Output isn't correct - L* = 0
10 Incorrect 56 ms 3056 KB Output isn't correct - L* = 0
11 Incorrect 68 ms 3056 KB Output isn't correct - L* = 0
12 Incorrect 66 ms 3056 KB Output isn't correct - L* = 0
13 Incorrect 66 ms 3056 KB Output isn't correct - L* = 0
14 Incorrect 56 ms 3056 KB Output isn't correct - L* = 0
15 Incorrect 60 ms 2864 KB Output isn't correct - L* = 0
16 Incorrect 61 ms 3000 KB Output isn't correct - L* = 0
17 Incorrect 46 ms 3112 KB Output isn't correct - L* = 0
18 Incorrect 61 ms 3056 KB Output isn't correct - L* = 0
19 Incorrect 48 ms 2800 KB Output isn't correct - L* = 0
20 Incorrect 54 ms 3056 KB Output isn't correct - L* = 0
21 Incorrect 53 ms 3312 KB Output isn't correct - L* = 0
22 Incorrect 53 ms 3056 KB Output isn't correct - L* = 0
23 Incorrect 49 ms 3056 KB Output isn't correct - L* = 0
24 Incorrect 50 ms 2920 KB Output isn't correct - L* = 0
25 Incorrect 56 ms 3096 KB Output isn't correct - L* = 0
26 Incorrect 53 ms 3056 KB Output isn't correct - L* = 0
27 Incorrect 67 ms 2800 KB Output isn't correct - L* = 0
28 Incorrect 55 ms 3056 KB Output isn't correct - L* = 0
29 Incorrect 55 ms 3048 KB Output isn't correct - L* = 0
30 Incorrect 60 ms 3000 KB Output isn't correct - L* = 0
31 Incorrect 54 ms 3056 KB Output isn't correct - L* = 0
32 Incorrect 48 ms 2960 KB Output isn't correct - L* = 0
33 Incorrect 50 ms 3056 KB Output isn't correct - L* = 0
34 Incorrect 52 ms 3072 KB Output isn't correct - L* = 0
35 Incorrect 49 ms 3056 KB Output isn't correct - L* = 0
36 Incorrect 51 ms 3056 KB Output isn't correct - L* = 0
37 Incorrect 55 ms 2808 KB Output isn't correct - L* = 0
38 Incorrect 52 ms 3056 KB Output isn't correct - L* = 0
39 Incorrect 56 ms 3056 KB Output isn't correct - L* = 0
40 Incorrect 48 ms 3056 KB Output isn't correct - L* = 0