結果
| 問題 | No.3681 心の沸騰石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 15:15:47 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,242 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 95,820 KB |
| 実行使用メモリ | 79,380 KB |
| 最終ジャッジ日時 | 2026-09-05 15:15:52 |
| 合計ジャッジ時間 | 3,128 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 11 WA * 2 |
ソースコード
import itertools
from functools import cache
import sys
sys.setrecursionlimit(10 ** 9)
import math
from collections import Counter, deque
input = lambda: sys.stdin.readline().rstrip()
mod = 998244353
r, p, q = map(int, input().split())
abcd = list(map(int, input().split()))
people = sum(abcd)
max_romania = people // 3
for i in range(3):
if max_romania < abcd[i]:
abcd[3] += abcd[i] - max_romania
abcd[i] = max_romania
# print(abcd)
abc = abcd[:3]
d = abc[-1]
abc.sort()
# print(abc)
# print(d)
ans = 0
if abc[0] * p <= r:
# print(abc)
# print(d)
# print(r)
# print("---1")
ans += abc[0]
r -= abc[0] * p
abc[2] -= abc[0]
abc[1] -= abc[0]
abc[0] -= abc[0]
if abc[1] * (q + p) <= r:
# print(abc)
# print(d)
# print(r)
# print("---2")
ans += abc[1]
r -= abc[1] * (q + p)
abc[2] -= abc[1]
abc[1] -= abc[1]
if abc[2] * (2 * q + p) <= r:
# print(abc)
# print(d)
# print(r)
# print("---3")
ans += abc[2]
print(ans)
else:
print(ans + r // (2 * q + p))
else:
print(ans + r // (q + p))
else:
print(r // p)