結果
| 問題 | No.3681 心の沸騰石 |
| コンテスト | |
| ユーザー |
ゆにたりー卿
|
| 提出日時 | 2026-06-18 01:52:38 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 58 ms / 2,000 ms |
| + 758µs | |
| コード長 | 625 bytes |
| 記録 | |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 96,080 KB |
| 実行使用メモリ | 79,048 KB |
| 最終ジャッジ日時 | 2026-09-05 12:30:49 |
| 合計ジャッジ時間 | 2,577 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
def solve():
R, P, Q = map(int, input().split())
CNTS = list(map(int, input().split()))
def judge(x):
required_cnt = sum(max(x - cnt, 0) for cnt in CNTS[:-1])
extra_cnt = sum(max(cnt - x, 0) for cnt in CNTS[:-1]) + CNTS[-1]
return (extra_cnt >= required_cnt) and (required_cnt * Q + x * P <= R)
ans = binary_search(judge)
print(ans)
def binary_search(judge, ok = 0, ng = 1 << 62):
while abs(ok - ng) > 1:
med = (ng + ok) // 2
if judge(med):
ok = med
else:
ng = med
return ok
if __name__ == "__main__":
solve()
ゆにたりー卿