結果
| 問題 |
No.2078 魔抜けなパープル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-25 22:51:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 164 ms |
| コンパイル使用メモリ | 82,452 KB |
| 実行使用メモリ | 152,216 KB |
| 最終ジャッジ日時 | 2024-12-22 14:54:56 |
| 合計ジャッジ時間 | 23,012 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 |
| other | RE * 1 TLE * 6 |
ソースコード
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
def answer():
X,A = map(int,input().split())
L = math.ceil(math.sqrt(X))
INF = (1<<30)
dp = [INF]*(A+1)
dp[0] = 0
for i in range(1,A+1):
dp[i] = min(k**2 + X + dp[i-k] for k in range(1,min(i,L)+1))
print(dp[A])
for _ in range(int(input())):
answer()