結果

問題 No.1167 Graduation Trip
ユーザー MitarushiMitarushi
提出日時 2020-08-11 15:42:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,887 ms / 4,000 ms
コード長 1,182 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 109,748 KB
最終ジャッジ日時 2024-04-17 17:24:03
合計ジャッジ時間 43,286 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,673 ms
109,184 KB
testcase_01 AC 1,359 ms
105,600 KB
testcase_02 AC 1,035 ms
102,292 KB
testcase_03 AC 1,706 ms
109,220 KB
testcase_04 AC 1,701 ms
109,184 KB
testcase_05 AC 1,379 ms
106,496 KB
testcase_06 AC 1,669 ms
109,168 KB
testcase_07 AC 1,304 ms
105,516 KB
testcase_08 AC 1,535 ms
103,104 KB
testcase_09 AC 1,550 ms
108,548 KB
testcase_10 AC 2,887 ms
109,312 KB
testcase_11 AC 2,229 ms
109,748 KB
testcase_12 AC 2,162 ms
109,628 KB
testcase_13 AC 2,112 ms
109,440 KB
testcase_14 AC 2,178 ms
109,440 KB
testcase_15 AC 1,811 ms
106,460 KB
testcase_16 AC 1,385 ms
102,912 KB
testcase_17 AC 2,116 ms
109,696 KB
testcase_18 AC 2,256 ms
109,184 KB
testcase_19 AC 2,103 ms
109,716 KB
testcase_20 AC 135 ms
77,300 KB
testcase_21 AC 128 ms
77,056 KB
testcase_22 AC 140 ms
77,228 KB
testcase_23 AC 149 ms
77,424 KB
testcase_24 AC 152 ms
77,568 KB
testcase_25 AC 120 ms
77,056 KB
testcase_26 AC 120 ms
77,140 KB
testcase_27 AC 137 ms
77,824 KB
testcase_28 AC 123 ms
77,184 KB
testcase_29 AC 121 ms
77,764 KB
testcase_30 AC 153 ms
81,152 KB
testcase_31 AC 227 ms
87,168 KB
testcase_32 AC 424 ms
89,600 KB
testcase_33 AC 849 ms
104,536 KB
testcase_34 AC 869 ms
105,984 KB
testcase_35 AC 33 ms
52,480 KB
testcase_36 AC 35 ms
52,736 KB
testcase_37 AC 52 ms
66,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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