結果

問題 No.733 分身並列コーディング
ユーザー shotoyooshotoyoo
提出日時 2021-05-09 19:37:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 751 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 94,040 KB
最終ジャッジ日時 2023-10-19 04:26:56
合計ジャッジ時間 18,253 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,412 KB
testcase_01 WA -
testcase_02 AC 47 ms
61,764 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 617 ms
93,828 KB
testcase_06 WA -
testcase_07 AC 625 ms
93,960 KB
testcase_08 AC 620 ms
93,964 KB
testcase_09 AC 369 ms
84,200 KB
testcase_10 AC 91 ms
72,900 KB
testcase_11 AC 94 ms
72,576 KB
testcase_12 AC 47 ms
61,764 KB
testcase_13 AC 40 ms
53,412 KB
testcase_14 AC 228 ms
79,624 KB
testcase_15 AC 77 ms
70,476 KB
testcase_16 AC 39 ms
53,412 KB
testcase_17 AC 49 ms
62,092 KB
testcase_18 AC 94 ms
73,556 KB
testcase_19 AC 369 ms
84,192 KB
testcase_20 AC 366 ms
84,216 KB
testcase_21 AC 230 ms
79,624 KB
testcase_22 AC 710 ms
93,880 KB
testcase_23 AC 230 ms
79,640 KB
testcase_24 AC 204 ms
79,616 KB
testcase_25 AC 60 ms
66,324 KB
testcase_26 AC 40 ms
53,412 KB
testcase_27 AC 79 ms
72,524 KB
testcase_28 AC 623 ms
93,856 KB
testcase_29 AC 702 ms
93,868 KB
testcase_30 AC 643 ms
93,884 KB
testcase_31 AC 716 ms
94,024 KB
testcase_32 AC 131 ms
77,460 KB
testcase_33 AC 132 ms
77,456 KB
testcase_34 AC 143 ms
77,460 KB
testcase_35 AC 133 ms
77,460 KB
testcase_36 AC 131 ms
77,460 KB
testcase_37 AC 131 ms
77,460 KB
testcase_38 AC 638 ms
93,884 KB
testcase_39 AC 715 ms
93,876 KB
testcase_40 AC 636 ms
93,880 KB
testcase_41 AC 133 ms
77,460 KB
testcase_42 AC 132 ms
77,472 KB
testcase_43 AC 132 ms
77,464 KB
testcase_44 AC 696 ms
93,876 KB
testcase_45 AC 688 ms
94,020 KB
testcase_46 AC 709 ms
94,020 KB
testcase_47 AC 640 ms
93,976 KB
testcase_48 AC 712 ms
93,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


t = int(input())
n = int(input())
a = [int(input()) for _ in range(n)]
inf = 10**12
dp = [[inf]*(1<<n) for _ in range(n+1)]
def chmin(dp,i,b,val):
    dp[i][b] = min(dp[i][b], val)
dp[0][0] = 0
for i in range(n):
    for b in range(1<<n):
        val = dp[i][b]
        for j in range(n):
            if b>>j&1:
                continue
            chmin(dp,i,b|(1<<j),val+a[j])
        if val<=t:
            chmin(dp,i+1,b,0)
ans = inf
for i in range(n):
    if dp[i][(1<<n)-1]==0:
        ans = i
        break
print(ans)
0