結果

問題 No.733 分身並列コーディング
ユーザー shotoyooshotoyoo
提出日時 2021-05-09 19:38:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 714 ms / 1,500 ms
コード長 753 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 93,932 KB
最終ジャッジ日時 2023-10-19 04:27:46
合計ジャッジ時間 17,593 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,772 KB
testcase_01 AC 41 ms
51,848 KB
testcase_02 AC 50 ms
59,620 KB
testcase_03 AC 689 ms
93,756 KB
testcase_04 AC 664 ms
93,760 KB
testcase_05 AC 617 ms
93,736 KB
testcase_06 AC 39 ms
51,728 KB
testcase_07 AC 622 ms
93,868 KB
testcase_08 AC 620 ms
93,864 KB
testcase_09 AC 367 ms
84,100 KB
testcase_10 AC 88 ms
72,728 KB
testcase_11 AC 92 ms
72,408 KB
testcase_12 AC 46 ms
59,616 KB
testcase_13 AC 39 ms
52,088 KB
testcase_14 AC 230 ms
79,520 KB
testcase_15 AC 76 ms
70,268 KB
testcase_16 AC 40 ms
52,092 KB
testcase_17 AC 50 ms
60,692 KB
testcase_18 AC 97 ms
73,388 KB
testcase_19 AC 367 ms
84,100 KB
testcase_20 AC 373 ms
84,116 KB
testcase_21 AC 228 ms
79,520 KB
testcase_22 AC 714 ms
93,792 KB
testcase_23 AC 229 ms
79,540 KB
testcase_24 AC 205 ms
79,512 KB
testcase_25 AC 60 ms
65,488 KB
testcase_26 AC 40 ms
52,096 KB
testcase_27 AC 79 ms
70,312 KB
testcase_28 AC 623 ms
93,768 KB
testcase_29 AC 699 ms
93,768 KB
testcase_30 AC 641 ms
93,796 KB
testcase_31 AC 707 ms
93,932 KB
testcase_32 AC 131 ms
77,360 KB
testcase_33 AC 131 ms
77,360 KB
testcase_34 AC 142 ms
77,364 KB
testcase_35 AC 131 ms
77,360 KB
testcase_36 AC 132 ms
77,360 KB
testcase_37 AC 131 ms
77,360 KB
testcase_38 AC 632 ms
93,788 KB
testcase_39 AC 713 ms
93,792 KB
testcase_40 AC 631 ms
93,792 KB
testcase_41 AC 130 ms
77,360 KB
testcase_42 AC 132 ms
77,372 KB
testcase_43 AC 132 ms
77,360 KB
testcase_44 AC 697 ms
93,792 KB
testcase_45 AC 688 ms
93,928 KB
testcase_46 AC 710 ms
93,928 KB
testcase_47 AC 636 ms
93,888 KB
testcase_48 AC 711 ms
93,792 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+1):
    if dp[i][(1<<n)-1]==0:
        ans = i
        break
print(ans)
0