結果

問題 No.733 分身並列コーディング
ユーザー convexineqconvexineq
提出日時 2021-03-17 19:53:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 260 ms / 1,500 ms
コード長 751 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 82,412 KB
最終ジャッジ日時 2024-04-27 12:19:09
合計ジャッジ時間 5,526 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,856 KB
testcase_01 AC 38 ms
52,364 KB
testcase_02 AC 39 ms
53,604 KB
testcase_03 AC 257 ms
81,960 KB
testcase_04 AC 260 ms
82,412 KB
testcase_05 AC 47 ms
61,364 KB
testcase_06 AC 39 ms
53,080 KB
testcase_07 AC 88 ms
67,944 KB
testcase_08 AC 75 ms
65,224 KB
testcase_09 AC 106 ms
69,980 KB
testcase_10 AC 59 ms
65,820 KB
testcase_11 AC 57 ms
63,708 KB
testcase_12 AC 40 ms
52,548 KB
testcase_13 AC 39 ms
54,088 KB
testcase_14 AC 82 ms
67,032 KB
testcase_15 AC 57 ms
64,268 KB
testcase_16 AC 40 ms
52,408 KB
testcase_17 AC 43 ms
58,984 KB
testcase_18 AC 58 ms
65,412 KB
testcase_19 AC 109 ms
68,676 KB
testcase_20 AC 94 ms
68,888 KB
testcase_21 AC 82 ms
67,204 KB
testcase_22 AC 161 ms
73,288 KB
testcase_23 AC 74 ms
66,412 KB
testcase_24 AC 68 ms
65,616 KB
testcase_25 AC 49 ms
60,540 KB
testcase_26 AC 41 ms
54,024 KB
testcase_27 AC 58 ms
64,972 KB
testcase_28 AC 76 ms
66,196 KB
testcase_29 AC 115 ms
69,708 KB
testcase_30 AC 115 ms
70,072 KB
testcase_31 AC 114 ms
70,636 KB
testcase_32 AC 60 ms
65,108 KB
testcase_33 AC 59 ms
65,316 KB
testcase_34 AC 62 ms
65,188 KB
testcase_35 AC 60 ms
64,816 KB
testcase_36 AC 61 ms
65,128 KB
testcase_37 AC 59 ms
65,068 KB
testcase_38 AC 103 ms
68,976 KB
testcase_39 AC 102 ms
69,324 KB
testcase_40 AC 102 ms
69,116 KB
testcase_41 AC 62 ms
66,128 KB
testcase_42 AC 59 ms
64,840 KB
testcase_43 AC 62 ms
65,928 KB
testcase_44 AC 104 ms
69,692 KB
testcase_45 AC 104 ms
69,236 KB
testcase_46 AC 104 ms
70,172 KB
testcase_47 AC 104 ms
69,840 KB
testcase_48 AC 104 ms
69,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def zeta_to_high(res,n):
    for i in range(n):
        i = 1<<i
        for j in range(1<<n):
            if j&i: res[j] += res[j^i]

def mobius_to_high(res,n):
    for i in range(n):
        i = 1<<i
        for j in range(1<<n):
            if j&i: res[j] -= res[j^i]

T,n,*a = map(int,open(0).read().split())
N = 1<<n
lst = [0]*N
for i in range(n):
    for j in range(1<<i):
        lst[j+(1<<i)] = lst[j] + a[i]
for i in range(N):
    lst[i] = int(lst[i] <= T)

if lst[-1]==1:
    print(1)
    exit()

MOD = 10**9+7
ans = 1
zeta_to_high(lst,n)
res = lst[:] 
while True:
    ans += 1
    for i in range(N):
        res[i] *= lst[i]
        res[i] %= MOD
    after = res[:]
    mobius_to_high(after,n)
    if after[-1]%MOD:
        break
print(ans)
0