Submission #785684

# Submission time Handle Problem Language Result Execution time Memory
785684 2023-07-17T12:39:26 Z MilosMilutinovic Broken Device (JOI17_broken_device) C++14
0 / 100
2 ms 568 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;
        }
        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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 512 KB Wrong Answer [4]
2 Incorrect 0 ms 512 KB Wrong Answer [4]
3 Incorrect 0 ms 520 KB Wrong Answer [4]
4 Incorrect 0 ms 512 KB Wrong Answer [4]
5 Incorrect 0 ms 512 KB Wrong Answer [4]
6 Incorrect 0 ms 520 KB Wrong Answer [4]
7 Incorrect 1 ms 512 KB Wrong Answer [4]
8 Incorrect 0 ms 520 KB Wrong Answer [4]
9 Incorrect 0 ms 512 KB Wrong Answer [4]
10 Incorrect 0 ms 512 KB Wrong Answer [4]
11 Incorrect 0 ms 520 KB Wrong Answer [4]
12 Incorrect 0 ms 512 KB Wrong Answer [4]
13 Incorrect 0 ms 512 KB Wrong Answer [4]
14 Incorrect 0 ms 520 KB Wrong Answer [4]
15 Incorrect 0 ms 536 KB Wrong Answer [4]
16 Incorrect 1 ms 520 KB Wrong Answer [4]
17 Incorrect 0 ms 516 KB Wrong Answer [4]
18 Incorrect 0 ms 512 KB Wrong Answer [4]
19 Incorrect 0 ms 520 KB Wrong Answer [4]
20 Incorrect 0 ms 520 KB Wrong Answer [4]
21 Incorrect 1 ms 512 KB Wrong Answer [4]
22 Incorrect 0 ms 512 KB Wrong Answer [4]
23 Incorrect 0 ms 512 KB Wrong Answer [4]
24 Incorrect 0 ms 512 KB Wrong Answer [4]
25 Incorrect 0 ms 520 KB Wrong Answer [4]
26 Incorrect 1 ms 520 KB Wrong Answer [4]
27 Incorrect 0 ms 532 KB Wrong Answer [4]
28 Incorrect 0 ms 512 KB Wrong Answer [4]
29 Incorrect 0 ms 520 KB Wrong Answer [4]
30 Incorrect 0 ms 512 KB Wrong Answer [4]
31 Incorrect 0 ms 512 KB Wrong Answer [4]
32 Incorrect 1 ms 512 KB Wrong Answer [4]
33 Incorrect 0 ms 512 KB Wrong Answer [4]
34 Incorrect 0 ms 512 KB Wrong Answer [4]
35 Incorrect 0 ms 512 KB Wrong Answer [4]
36 Incorrect 2 ms 520 KB Wrong Answer [4]
37 Incorrect 0 ms 568 KB Wrong Answer [4]
38 Incorrect 0 ms 512 KB Wrong Answer [4]
39 Incorrect 0 ms 512 KB Wrong Answer [4]
40 Incorrect 0 ms 512 KB Wrong Answer [4]