제출 #753742

#제출 시각아이디문제언어결과실행 시간메모리
753742piOOEBroken Device (JOI17_broken_device)C++17
8 / 100
40 ms2700 KiB
#include "Annalib.h"

void set(int i, int x, int y, int z) {
    Set(i, x), Set(i + 1, y), Set(i + 2, z);
}

void Anna(int N, long long X, int K, int P[]) {
    int used[150]{};

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

    for (int i = 0, c = 0; i < N; i += 3) {
        if (c > 60) {
            c = 60;
        }
        if (used[i] + used[i + 1] + used[i + 2] == 0) {
            set(i, 1, X >> c & 1LL, X >> (c + 1) & 1LL);
            c += 2;
        } else if (used[i] + used[i + 1] + used[i + 2] == 1) {
            set(i, 0, X >> c & 1LL, X >> c & 1LL);
            c += 1;
        } else {
            set(i, 0, 0, 0);
        }
    }
}
#include "Brunolib.h"

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

    for (int i = 0, c = 0; i < N; i += 3) {
        if (c > 60) {
            c = 60;
        }
        if (A[i]) {
            X += (A[i + 1] + A[i + 2] * 2LL) << c;
            c += 2;
        } else {
            X += ((long long) (A[i + 1] || A[i + 2])) << c;
            c += 1;
        }
    }

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