結果
問題 | No.733 分身並列コーディング |
ユーザー |
![]() |
提出日時 | 2024-04-06 04:34:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,265 ms / 1,500 ms |
コード長 | 376 bytes |
コンパイル時間 | 433 ms |
コンパイル使用メモリ | 81,972 KB |
実行使用メモリ | 78,944 KB |
最終ジャッジ日時 | 2024-10-01 03:42:49 |
合計ジャッジ時間 | 26,055 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
T=int(input()) N=int(input()) time=[int(input()) for i in range(N)] inf=1<<30 dp=[inf]*(1<<N) dp[0]=0 sum_time=[sum(time[i] for i in range(N)if bit&1<<i) for bit in range(1<<N)] for bit in range(1<<N): subset=bit while subset: if sum_time[subset]<=T: dp[bit]=min(dp[bit],dp[bit^subset]+1) subset-=1 subset&=bit ans=dp[-1] print(ans)