結果

問題 No.3068 Speedrun (Hard)
ユーザー PNJ
提出日時 2025-03-22 16:24:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 65,496 KB
最終ジャッジ日時 2025-03-22 16:24:50
合計ジャッジ時間 15,379 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, C, D, N = map(int, input().split())
P, Q, R, S, T = map(int, input().split())
for na in range(A + 1):
  for nb in range(B + 1):
    if na + nb > N:
      break
    t = T - P * na - Q * nb + (na + nb - N) * S
    if R == S:
      if t == 0:
        nc = min(C, N - na - nb)
        nd = N - na - nb
        if 0 <= nd <= D:
          print(na, nb, nc, nd)
          exit()
        else:
          continue
      else:
        continue
    if (R - S) * t < 0:
      continue
    if t % (R - S):
      continue
    nc = t // (R - S)
    if nc > C:
      continue
    nd = N - na - nb - nc
    if 0 <= nd <= D:
      print(na, nb, nc, nd)
      exit()
0