結果
| 問題 | No.733 分身並列コーディング |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-05 09:10:23 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 1,500 ms |
| コード長 | 616 bytes |
| 記録 | |
| コンパイル時間 | 188 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 71,296 KB |
| 最終ジャッジ日時 | 2026-05-01 11:18:00 |
| 合計ジャッジ時間 | 4,782 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# %%
T, N, *A = map(int, read().split())
# %%
INF = 10 ** 9
dp = [INF] * (1 << N)
dp[0] = 0
for subset in range(1 << N):
for i, x in enumerate(A):
if subset & (1 << i):
t = dp[subset ^ (1 << i)]
q, r = divmod(t, T)
if r + x <= T:
t += x
else:
t = (q + 1) * T + x
if dp[subset] > t:
dp[subset] = t
# %%
answer = (dp[-1] + T - 1) // T
print(answer)
maspy