結果
| 問題 |
No.3068 Speedrun (Hard)
|
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-05-04 03:52:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,635 ms / 2,000 ms |
| コード長 | 926 bytes |
| コンパイル時間 | 598 ms |
| コンパイル使用メモリ | 81,932 KB |
| 実行使用メモリ | 66,300 KB |
| 最終ジャッジ日時 | 2025-05-04 03:53:04 |
| 合計ジャッジ時間 | 11,363 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
A, B, C, D, N = map(int, input().split())
P, Q, R, S, T = map(int, input().split())
def func(n, t):
if C+D < n:
return -1, -1
if R == S:
if R*n == t:
c, d = 0, 0
c = min(t//R, C)
if R*c < t:
d = (t-(R*c))//R
return c, d
else:
return -1, -1
else:
top = S*n-t
bottom = S-R
if top%bottom == 0:
c = top//bottom
if 0 <= c <= C and 0 <= n-c <= D:
return c, n-c
else:
return -1, -1
else:
return -1, -1
for a in range(A+1):
if N < a:
break
if T < P*a:
break
for b in range(B+1):
if N < a+b:
break
if T < P*a+Q*b:
break
n = N-a-b
t = T-P*a-Q*b
c, d = func(n, t)
if c != -1:
exit(print(a, b, c, d))
detteiuu