結果
| 問題 |
No.2927 Reverse Polish Equation
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2024-10-14 16:06:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 542 ms / 2,000 ms |
| コード長 | 281 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 138,752 KB |
| 最終ジャッジ日時 | 2024-10-16 00:32:49 |
| 合計ジャッジ時間 | 11,534 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
Y=int(input().split()[1]) S=input().split() def f(x): A=[] for s in S: if"0">s:a=A.pop();A[-1]+=a elif"m">s:A+=[int(s)if"X">s else x] else:A[-2]=[min,max]["mi">s](A[-2:]);A.pop() return A[0] l,r=-1,Y while l<r-1: m=(l+r)>>1 if f(m)<Y:l=m else:r=m print([-1,r][f(r)==Y])