Submission #1456833


Source Code Expand

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ui = unsigned int;
using vu = vector<ui>;
using vvu = vector<vu>;
using vvvu = vector<vvu>;

int main() {
    int K, M; cin >> K >> M; M--;
    vu A(K);
    vvu C(K, vu(K));
    for (int i=1; i<=K; i++) cin >> A[K-i];
    for (int i=0; i<K; i++) cin >> C[0][i];
    for (int i=1; i<K; i++) C[i][i-1] = 0xFFFFFFFF;

    for (int s=0; s<32; s++) {
        if ((M >> s) % 2) {
            vu B(K);
            for (int i=0; i<K; i++) {
                for (int j=0; j<K; j++) B[i] ^= C[i][j] & A[j];
            }
            A = B;
        }
        vvu D(K, vu(K));
        for (int j=0; j<K; j++) for (int k=0; k<K; k++) {
            for (int l=0; l<K; l++) D[j][k] ^= C[j][l] & C[l][k];
        }
        C = D;
    }

    cout << A[K-1] << endl;
    return 0;
}

Submission Info

Submission Time
Task D - 漸化式
User hidollara
Language C++14 (GCC 5.4.1)
Score 100
Code Size 888 Byte
Status AC
Exec Time 37 ms
Memory 764 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 20
Set Name Test Cases
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_1.txt, sample_2.txt, sample_3.txt, small_1.txt, small_2.txt
Case Name Status Exec Time Memory
random_01.txt AC 6 ms 764 KB
random_02.txt AC 1 ms 256 KB
random_03.txt AC 1 ms 256 KB
random_04.txt AC 1 ms 256 KB
random_05.txt AC 1 ms 256 KB
random_06.txt AC 1 ms 256 KB
random_07.txt AC 3 ms 256 KB
random_08.txt AC 6 ms 256 KB
random_09.txt AC 36 ms 384 KB
random_10.txt AC 37 ms 384 KB
random_11.txt AC 37 ms 384 KB
random_12.txt AC 37 ms 384 KB
random_13.txt AC 37 ms 384 KB
random_14.txt AC 37 ms 384 KB
random_15.txt AC 37 ms 384 KB
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 2 ms 256 KB
small_1.txt AC 1 ms 256 KB
small_2.txt AC 1 ms 256 KB