結果

問題 No.733 分身並列コーディング
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-07-26 13:03:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 575 ms / 1,500 ms
コード長 714 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,844 KB
実行使用メモリ 95,600 KB
最終ジャッジ日時 2024-04-14 03:02:23
合計ジャッジ時間 14,333 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
56,904 KB
testcase_01 AC 44 ms
57,260 KB
testcase_02 AC 50 ms
62,628 KB
testcase_03 AC 541 ms
95,108 KB
testcase_04 AC 575 ms
95,232 KB
testcase_05 AC 460 ms
95,396 KB
testcase_06 AC 44 ms
55,692 KB
testcase_07 AC 480 ms
95,224 KB
testcase_08 AC 471 ms
95,428 KB
testcase_09 AC 269 ms
85,408 KB
testcase_10 AC 87 ms
77,804 KB
testcase_11 AC 89 ms
77,528 KB
testcase_12 AC 49 ms
64,376 KB
testcase_13 AC 45 ms
56,740 KB
testcase_14 AC 161 ms
80,712 KB
testcase_15 AC 73 ms
74,564 KB
testcase_16 AC 45 ms
56,552 KB
testcase_17 AC 56 ms
66,292 KB
testcase_18 AC 86 ms
77,504 KB
testcase_19 AC 275 ms
85,420 KB
testcase_20 AC 269 ms
86,012 KB
testcase_21 AC 163 ms
81,280 KB
testcase_22 AC 530 ms
95,228 KB
testcase_23 AC 164 ms
81,128 KB
testcase_24 AC 155 ms
80,724 KB
testcase_25 AC 62 ms
69,736 KB
testcase_26 AC 45 ms
56,364 KB
testcase_27 AC 74 ms
73,944 KB
testcase_28 AC 477 ms
95,484 KB
testcase_29 AC 505 ms
95,212 KB
testcase_30 AC 501 ms
95,144 KB
testcase_31 AC 503 ms
95,284 KB
testcase_32 AC 107 ms
78,540 KB
testcase_33 AC 108 ms
78,580 KB
testcase_34 AC 106 ms
78,600 KB
testcase_35 AC 106 ms
78,740 KB
testcase_36 AC 106 ms
78,624 KB
testcase_37 AC 106 ms
78,536 KB
testcase_38 AC 489 ms
95,240 KB
testcase_39 AC 490 ms
95,464 KB
testcase_40 AC 493 ms
95,280 KB
testcase_41 AC 110 ms
78,604 KB
testcase_42 AC 106 ms
78,612 KB
testcase_43 AC 107 ms
79,016 KB
testcase_44 AC 491 ms
95,600 KB
testcase_45 AC 493 ms
95,524 KB
testcase_46 AC 494 ms
95,244 KB
testcase_47 AC 492 ms
95,548 KB
testcase_48 AC 487 ms
95,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

T = int(input())
N = int(input())
t = [int(input()) for _ in range(N)]
INF = (1<<30)
dp = [[INF]*(1<<N) for _ in range(N+1)]
dp[0][0] = 0
    
for i in range(1<<N):
    cnd = []
    for j in range(N):
        if (i>>j)&1:
            continue
        else:
            cnd.append(j)
    
    for k in range(N):
        
        for c in cnd:
            
            S = i|(1<<c)
            dp[k][S] = min(dp[k][S],dp[k][i] + t[c])
            if dp[k][S]<=T:
                dp[k+1][S] = 0
          
for i in range(N+1):
    if dp[i][-1]==0:
        print(i)
        exit()
0