Submission #753507

#TimeUsernameProblemLanguageResultExecution timeMemory
753507piOOEBroken Device (JOI17_broken_device)C++17
81 / 100
37 ms2488 KiB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr ll Y = 439789002196527822LL;
vector<int> p = {120, 61, 3, 105, 66, 81, 101, 117, 14, 56, 5, 59, 126, 26, 49, 16, 46, 118, 106, 79, 8, 148, 136, 91, 94, 29, 39, 111, 40, 75, 147, 125, 68, 127, 73, 92, 77, 45, 131, 99, 2, 80, 149, 134, 102, 82, 129, 18, 28, 63, 139, 122, 72, 32, 69, 35, 71, 36, 70, 57, 143, 145, 93, 6, 38, 130, 33, 88, 140, 12, 116, 123, 119, 128, 10, 19, 52, 17, 60, 142, 20, 110, 90, 67, 25, 107, 48, 62, 0, 141, 124, 137, 31, 24, 104, 74, 51, 95, 7, 9, 27, 34, 42, 64, 55, 15, 146, 11, 58, 47, 65, 121, 22, 97, 109, 43, 83, 54, 78, 103, 87, 113, 4, 115, 30, 133, 135, 23, 53, 1, 100, 86, 112, 84, 114, 44, 50, 96, 85, 21, 37, 76, 89, 41, 144, 98, 13, 132, 108, 138};
const string B = "010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101";

void Anna(int N, long long X, int K, int P[]) {
    vector<int> a(N), used(N);
    X ^= Y;

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

    for (int i = 0, b = 0; i < N; ++i) {
        if (!used[p[i]] && (X >> b & 1) == (B[i] - '0')) {
            a[p[i]] = 1;
            b += 1;
        }
    }

    for (int i = 0; i < N; i++) {
        Set(i, a[i]);
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr ll Y = 439789002196527822LL;
vector<int> p = {120, 61, 3, 105, 66, 81, 101, 117, 14, 56, 5, 59, 126, 26, 49, 16, 46, 118, 106, 79, 8, 148, 136, 91, 94, 29, 39, 111, 40, 75, 147, 125, 68, 127, 73, 92, 77, 45, 131, 99, 2, 80, 149, 134, 102, 82, 129, 18, 28, 63, 139, 122, 72, 32, 69, 35, 71, 36, 70, 57, 143, 145, 93, 6, 38, 130, 33, 88, 140, 12, 116, 123, 119, 128, 10, 19, 52, 17, 60, 142, 20, 110, 90, 67, 25, 107, 48, 62, 0, 141, 124, 137, 31, 24, 104, 74, 51, 95, 7, 9, 27, 34, 42, 64, 55, 15, 146, 11, 58, 47, 65, 121, 22, 97, 109, 43, 83, 54, 78, 103, 87, 113, 4, 115, 30, 133, 135, 23, 53, 1, 100, 86, 112, 84, 114, 44, 50, 96, 85, 21, 37, 76, 89, 41, 144, 98, 13, 132, 108, 138};
const string B = "010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101";

long long Bruno(int N, int A[]) {
    ll X = 0;

    for (int i = 0, b = 0; i < N; ++i) {
        if (A[p[i]]) {
            X |= ll(B[i] - '0') << b;
            b += 1;
        }
    }

    X ^= Y;

    return X;
}
#Verdict Execution timeMemoryGrader output
Fetching results...