結果

問題 No.3068 Speedrun (Hard)
ユーザー 回転
提出日時 2025-05-22 02:11:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 63,620 KB
最終ジャッジ日時 2025-05-22 02:11:17
合計ジャッジ時間 11,465 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,C,D,N = list(map(int,input().split()))
P,Q,R,S,T = list(map(int,input().split()))

for a in range(A+1):
    for b in range(B+1):
        nokori = N - (a+b)
        nokori_t = T - (a*P+b*Q)
        if(nokori < 0):break
        if(nokori_t < 0):break
        if(S != R):
            d = (nokori_t - R*nokori)//(S-R)
            c = nokori - d
            if(c*R+d*S != nokori_t):continue
            if(c <= C and d <= D):
                print(a,b,c,d)
                exit()
        else:
            if(nokori*S != nokori_t):
                #print("hello")
                continue

            c = min(nokori,C)
            nokori -= c
            d = min(nokori,D)
            if(a+b+c+d == N):
                print(a,b,c,d)
                exit()
0