Submission #1821880


Source Code Expand

Copy
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto A = N.iota.map!(_ => readln.chomp.to!int).array;
    long[int][2] dp;
    dp[0][0] = 1;
    int cur = 0, tar = 1;

    foreach (i; 0..N) {
        dp[tar] = dp[cur].dup;
        foreach (k; dp[cur].keys) {
            (dp[tar][k^A[i]] += dp[cur][k]) %= MOD;
        }
        cur ^= 1;
        tar ^= 1;
    }

    if (K in dp[cur]) {
        writeln(dp[cur][K]);
    } else {
        writeln(0);
    }


}

Submission Info

Submission Time
Task F - Limited Xor Subset
User nebukuro09
Language D (LDC 0.17.0)
Score 0
Code Size 753 Byte
Status CE

Compile Error

#0 0x133f098 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/ldc/bin/ldc2+0x133f098)
#1 0x133e2cb SignalHandler(int) (/opt/ldc/bin/ldc2+0x133e2cb)
#2 0x7f19e1378330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x6ea75b DtoAssign(Loc&, DValue*, DValue*, int, bool) (/opt/ldc/bin/ldc2+0x6ea75b)
#4 0x734548 ToElemVisitor::visit(ModAssignExp*) (/opt/ldc/bin/ldc2+0x734548)
#5 0x735580 toElemDtor(Expression*) (/opt/ldc/bin/ldc2+0x735580)
#6 0x78204f ToIRVisitor::visit(ExpStatement*) (/opt/ldc/bin/ldc2+0x78204f)
#7 0x781fc4 ToIRVisitor::visit(CompoundStatement*) (/opt/ldc/bin/ldc2+0x781fc4)
#8 0x784312 ToIRVisitor::visit(ForStatement*) (/opt/ldc/bin/ldc2+0x784312)
#9 0x781fc4 ToIRVisitor::visit(CompoundStatement*) (/opt/ldc/bin/ldc2+0x781fc4)
#10 0x7820fa ToIRVisitor::visit(ScopeStatement*) (/opt/ldc/bin/ldc2+0x7820fa)
#11 0x781fc4 ToIRVisitor::visit(CompoundStatement*) (/opt/ldc/bin/ldc2+0x781fc4)
#12 0x784312 ToIRVisitor::visit(ForStatement*) (/opt/ldc/bin/ldc2+0x784312)
#13 0x781fc4 ToIRVis...