結果
問題 |
No.733 分身並列コーディング
|
ユーザー |
|
提出日時 | 2023-07-26 13:03:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 579 ms / 1,500 ms |
コード長 | 714 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 82,192 KB |
実行使用メモリ | 95,488 KB |
最終ジャッジ日時 | 2024-10-03 00:24:37 |
合計ジャッジ時間 | 13,458 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
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()