結果

問題 No.27 板の準備
ユーザー qibqib
提出日時 2023-02-08 02:01:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 187 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 79,976 KB
最終ジャッジ日時 2023-09-19 06:13:59
合計ジャッジ時間 5,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
78,908 KB
testcase_01 AC 169 ms
79,320 KB
testcase_02 AC 185 ms
79,684 KB
testcase_03 AC 187 ms
79,868 KB
testcase_04 AC 173 ms
79,104 KB
testcase_05 AC 178 ms
79,652 KB
testcase_06 AC 182 ms
79,888 KB
testcase_07 AC 176 ms
79,976 KB
testcase_08 AC 183 ms
79,848 KB
testcase_09 AC 182 ms
79,684 KB
testcase_10 AC 168 ms
79,176 KB
testcase_11 AC 178 ms
79,560 KB
testcase_12 AC 181 ms
79,836 KB
testcase_13 AC 172 ms
79,188 KB
testcase_14 AC 169 ms
79,044 KB
testcase_15 AC 171 ms
79,096 KB
testcase_16 AC 167 ms
79,140 KB
testcase_17 AC 176 ms
79,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 1 << 60

v = list(map(int, input().split()))

m = 30

ans = INF
for a in range(1, m + 1):
  for b in range(a + 1, m + 1):
    for c in range(b + 1, m + 1):
      dp = [INF for _ in range(m + 1)]
      dp[0] = 0
      for x in range(m):
        if dp[x] == INF:
          continue
        for y in [a, b, c]:
          if x + y <= m:
            dp[x + y] = min(dp[x + y], dp[x] + 1)

      if max(dp[x] for x in v) < INF:
        ans = min(ans, sum(dp[x] for x in v))

print(ans)
0