結果

問題 No.1167 Graduation Trip
ユーザー MitarushiMitarushi
提出日時 2020-08-11 15:40:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,666 ms / 4,000 ms
コード長 1,143 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 109,260 KB
最終ジャッジ日時 2024-04-17 17:22:53
合計ジャッジ時間 40,930 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,532 ms
108,416 KB
testcase_01 AC 1,246 ms
105,192 KB
testcase_02 AC 962 ms
101,932 KB
testcase_03 AC 1,589 ms
108,676 KB
testcase_04 AC 1,564 ms
108,568 KB
testcase_05 AC 1,311 ms
106,544 KB
testcase_06 AC 1,597 ms
109,260 KB
testcase_07 AC 1,203 ms
104,820 KB
testcase_08 AC 1,417 ms
102,884 KB
testcase_09 AC 1,428 ms
107,444 KB
testcase_10 AC 2,666 ms
109,240 KB
testcase_11 AC 1,988 ms
108,896 KB
testcase_12 AC 1,986 ms
109,240 KB
testcase_13 AC 1,915 ms
108,780 KB
testcase_14 AC 1,989 ms
109,056 KB
testcase_15 AC 1,640 ms
106,140 KB
testcase_16 AC 1,274 ms
102,540 KB
testcase_17 AC 1,966 ms
108,976 KB
testcase_18 AC 2,059 ms
108,380 KB
testcase_19 AC 1,927 ms
108,904 KB
testcase_20 AC 184 ms
78,376 KB
testcase_21 AC 154 ms
77,560 KB
testcase_22 AC 174 ms
77,872 KB
testcase_23 AC 165 ms
77,432 KB
testcase_24 AC 163 ms
77,384 KB
testcase_25 AC 143 ms
77,656 KB
testcase_26 AC 146 ms
77,656 KB
testcase_27 AC 189 ms
77,504 KB
testcase_28 AC 162 ms
78,012 KB
testcase_29 AC 155 ms
77,060 KB
testcase_30 AC 162 ms
81,144 KB
testcase_31 AC 235 ms
87,436 KB
testcase_32 AC 398 ms
89,212 KB
testcase_33 AC 759 ms
104,260 KB
testcase_34 AC 771 ms
105,836 KB
testcase_35 AC 32 ms
52,836 KB
testcase_36 AC 31 ms
54,332 KB
testcase_37 AC 48 ms
67,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

mod = 10**9+7


def merge_base(a, b):
    c = a + b

    i = 1
    k = 0
    for _ in range(40):
        for j in range(k, len(c)):
            if (i & c[j]) != 0:
                break
        else:
            i <<= 1
            continue

        c[j], c[k] = c[k], c[j]
        for j in range(k + 1, len(c)):
            if (i & c[j]) != 0:
                c[j] ^= c[k]
        i <<= 1
        k += 1

    return c[:k]


table = [[] for _ in range(15)]
table[0] = [[i] if i != 0 else[] for i in a]
for i in range(1, 15):
    for j in range(n - (1 << i) + 1):
        table[i].append(merge_base(table[i - 1][j],
                                   table[i - 1][j + (1 << (i-1))]))


def get_section(i, j):
    k = (j - i).bit_length() - 1
    return merge_base(table[k][i], table[k][j-(1 << k)])


for _ in range(q):
    m = int(input())
    b = [0]
    for i in input().split():
        b.append(int(i))
    b.append(n)

    power = n
    for i in range(m + 1):
        j, k = b[i], b[i+1]
        power -= len(get_section(j, k))
    print(pow(2, power, mod))
0