結果
| 問題 |
No.2746 Bicolor Pyramid
|
| コンテスト | |
| ユーザー |
PNJ
|
| 提出日時 | 2024-04-20 12:57:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 431 bytes |
| コンパイル時間 | 501 ms |
| コンパイル使用メモリ | 82,956 KB |
| 実行使用メモリ | 64,640 KB |
| 最終ジャッジ日時 | 2024-10-12 08:21:44 |
| 合計ジャッジ時間 | 7,373 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 WA * 2 |
ソースコード
R,B = map(int,input().split())
l = 1
r = 2000000
while r - l > 1:
k = (l + r) // 2
s = k*(k+1)*(2*k+1) // 6
f = 0
RR,BB = R,B
for kk in range(k,0,-1):
if RR >= kk*kk:
RR -= kk*kk
s -= kk*kk
if s <= BB:
f = 1
s = k*(k+1)*(2*k+1) // 6
RR,BB = B,R
for kk in range(k,0,-1):
if RR >= kk*kk:
RR -= kk*kk
s -= kk*kk
if s <= BB:
f = 1
if f:
l = k
else:
r = k
print(l)
PNJ