답안 #785683

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
785683 2023-07-17T12:38:52 Z MilosMilutinovic Broken Device (JOI17_broken_device) C++14
0 / 100
2 ms 732 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
string str[] = {"0", "1", "1", "1", "00", "10", "11", "01"};
bool bad[200];
void Anna(int N, long long X, int K, int P[]) {
	for (int i = 0; i < N; i++)
		bad[i] = false;
	for (int i = 0; i < K; i++)
        bad[P[i]] = true;
    int ptr = 0;
    for (int i = 0; i < N; i += 3) {
        int cnt = bad[i] + bad[i + 1] + bad[i + 2];
        if (cnt >= 2) {
            Set(i, 0);
            Set(i + 1, 0);
            Set(i + 2, 0);
            continue;
        }
        if (cnt == 0) {
            for (int j = 1; j <= 7; j++) {
                if (str[j].size() == 1) {
                    continue;
                }
                int bit0 = (X >> ptr & 1);
                int bit1 = (X >> (ptr + 1) & 1);
                if ((str[j][0] - '0') == bit0 && (str[j][1] - '0') == bit1) {
                    Set(i, j >> 2 & 1);
                    Set(i + 1, j >> 1 & 1);
                    Set(i + 2, j >> 0 & 1);
                    break;
                }
            }
            ptr += 2;
            continue;
        }
        int f = (bad[i] ? 2 : (bad[i + 1] ? 1 : 0));
        for (int j = 1; j <= 7; j++) {
            if (j >> f & 1) {
                continue;
            }
            bool ok = true;
            for (int k = 0; k < (int) str[j].size(); k++) {
                int bit = (X >> (ptr + k) & 1);
                if (bit != (str[j][k] - '0')) {
                    ok = false;
                }
            }
            if (ok) {
                Set(i, j >> 2 & 1);
                Set(i + 1, j >> 1 & 1);
                Set(i + 2, j >> 0 & 1);
                ptr += str[j].size();
                break;
            }
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
string str[] = {"0", "1", "1", "1", "00", "10", "11", "01"};
long long Bruno(int N, int A[]) {
    long long bit = 0;
    long long ans = 0;
    for (int i = 0; i < N; i += 3) {
        int x = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
        if (x == 0) {
            continue;
        }
        cout << x << '\n';
        for (int j = 0; j < (int) str[x].size(); j++) {
            int d = (str[x][j] - '0');
            ans += (1LL << bit) * d;
            bit += 1;
        }
        if (bit >= 60) {
			break;
		}
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 684 KB Wrong Answer [4]
2 Incorrect 2 ms 688 KB Wrong Answer [4]
3 Incorrect 2 ms 684 KB Wrong Answer [4]
4 Incorrect 1 ms 696 KB Wrong Answer [4]
5 Incorrect 1 ms 692 KB Wrong Answer [4]
6 Incorrect 1 ms 696 KB Wrong Answer [4]
7 Incorrect 1 ms 688 KB Wrong Answer [4]
8 Incorrect 1 ms 696 KB Wrong Answer [4]
9 Incorrect 1 ms 688 KB Wrong Answer [4]
10 Incorrect 1 ms 656 KB Wrong Answer [4]
11 Incorrect 1 ms 696 KB Wrong Answer [4]
12 Incorrect 1 ms 688 KB Wrong Answer [4]
13 Incorrect 2 ms 668 KB Wrong Answer [4]
14 Incorrect 2 ms 688 KB Wrong Answer [4]
15 Incorrect 1 ms 668 KB Wrong Answer [4]
16 Incorrect 1 ms 696 KB Wrong Answer [4]
17 Incorrect 1 ms 688 KB Wrong Answer [4]
18 Incorrect 1 ms 696 KB Wrong Answer [4]
19 Incorrect 1 ms 684 KB Wrong Answer [4]
20 Incorrect 1 ms 696 KB Wrong Answer [4]
21 Incorrect 1 ms 688 KB Wrong Answer [4]
22 Incorrect 1 ms 684 KB Wrong Answer [4]
23 Incorrect 1 ms 688 KB Wrong Answer [4]
24 Incorrect 1 ms 688 KB Wrong Answer [4]
25 Incorrect 2 ms 688 KB Wrong Answer [4]
26 Incorrect 1 ms 684 KB Wrong Answer [4]
27 Incorrect 1 ms 688 KB Wrong Answer [4]
28 Incorrect 1 ms 684 KB Wrong Answer [4]
29 Incorrect 1 ms 688 KB Wrong Answer [4]
30 Incorrect 1 ms 688 KB Wrong Answer [4]
31 Incorrect 1 ms 688 KB Wrong Answer [4]
32 Incorrect 1 ms 700 KB Wrong Answer [4]
33 Incorrect 1 ms 668 KB Wrong Answer [4]
34 Incorrect 1 ms 688 KB Wrong Answer [4]
35 Incorrect 1 ms 688 KB Wrong Answer [4]
36 Incorrect 1 ms 688 KB Wrong Answer [4]
37 Incorrect 1 ms 688 KB Wrong Answer [4]
38 Incorrect 1 ms 688 KB Wrong Answer [4]
39 Incorrect 1 ms 688 KB Wrong Answer [4]
40 Incorrect 1 ms 732 KB Wrong Answer [4]