結果
| 問題 |
No.2078 魔抜けなパープル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-25 22:17:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 385 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 82,112 KB |
| 実行使用メモリ | 84,868 KB |
| 最終ジャッジ日時 | 2024-12-22 14:44:06 |
| 合計ジャッジ時間 | 1,828 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 4 RE * 1 |
ソースコード
from heapq import heappop
t = int(input())
for i in range(t):
x,a = map(int,input().split())
INF = 10**18
dp = [INF]*(a+1)
dp[0] = 0
ks = []
border = int(x**0.5)+1
for i in range(border-2, border+2):
ks.append([i,i*i+x])
for i in range(1,a+1):
dp[i] = i*i+x
for j,jc in ks:
if j > i: break
dp[i] = min(dp[i], dp[i-j]+ jc)
print(dp[-1])