結果

問題 No.733 分身並列コーディング
ユーザー convexineqconvexineq
提出日時 2021-03-17 19:42:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 298 ms / 1,500 ms
コード長 703 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 98,708 KB
最終ジャッジ日時 2024-04-27 12:06:48
合計ジャッジ時間 5,688 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,136 KB
testcase_01 AC 40 ms
52,708 KB
testcase_02 AC 40 ms
52,608 KB
testcase_03 AC 298 ms
98,584 KB
testcase_04 AC 298 ms
98,708 KB
testcase_05 AC 47 ms
60,312 KB
testcase_06 AC 39 ms
53,672 KB
testcase_07 AC 88 ms
66,836 KB
testcase_08 AC 74 ms
65,604 KB
testcase_09 AC 123 ms
83,504 KB
testcase_10 AC 57 ms
64,108 KB
testcase_11 AC 57 ms
63,992 KB
testcase_12 AC 38 ms
53,852 KB
testcase_13 AC 39 ms
53,824 KB
testcase_14 AC 86 ms
72,984 KB
testcase_15 AC 55 ms
63,640 KB
testcase_16 AC 38 ms
52,436 KB
testcase_17 AC 42 ms
58,612 KB
testcase_18 AC 56 ms
63,556 KB
testcase_19 AC 135 ms
83,872 KB
testcase_20 AC 110 ms
82,580 KB
testcase_21 AC 77 ms
66,352 KB
testcase_22 AC 215 ms
91,032 KB
testcase_23 AC 80 ms
72,724 KB
testcase_24 AC 65 ms
65,260 KB
testcase_25 AC 47 ms
60,804 KB
testcase_26 AC 38 ms
53,448 KB
testcase_27 AC 54 ms
63,592 KB
testcase_28 AC 75 ms
65,924 KB
testcase_29 AC 112 ms
69,784 KB
testcase_30 AC 113 ms
69,536 KB
testcase_31 AC 111 ms
70,144 KB
testcase_32 AC 58 ms
64,672 KB
testcase_33 AC 58 ms
65,512 KB
testcase_34 AC 58 ms
64,584 KB
testcase_35 AC 58 ms
64,048 KB
testcase_36 AC 57 ms
64,476 KB
testcase_37 AC 58 ms
64,380 KB
testcase_38 AC 101 ms
69,344 KB
testcase_39 AC 104 ms
68,972 KB
testcase_40 AC 101 ms
69,656 KB
testcase_41 AC 60 ms
64,756 KB
testcase_42 AC 58 ms
64,524 KB
testcase_43 AC 60 ms
64,692 KB
testcase_44 AC 102 ms
69,720 KB
testcase_45 AC 102 ms
68,432 KB
testcase_46 AC 101 ms
69,452 KB
testcase_47 AC 101 ms
68,640 KB
testcase_48 AC 101 ms
69,336 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()

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