結果

問題 No.2493 K-th in L2 with L1
ユーザー KoiKoi
提出日時 2023-10-06 21:30:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,344 KB
実行使用メモリ 76,396 KB
最終ジャッジ日時 2023-10-06 21:30:12
合計ジャッジ時間 1,330 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,220 KB
testcase_01 AC 84 ms
76,124 KB
testcase_02 AC 84 ms
76,392 KB
testcase_03 AC 85 ms
76,396 KB
testcase_04 AC 69 ms
71,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
answers=[]
for i in range(Q):
    D,K=map(int,input().split())
    if(D==0):
        if(K==1):
            answers.append(["Yes","0 0"])
        else:
            answers.append(["No"])
        continue
    if(D*4<K):
        answers.append(["No"])
    else:
        l=[]
        for i in range(D):
            for j in range(4):
                l.append([(D-i)**2+(i)**2,i])
        l.sort()
        x=l[K-1][1]
        answers.append(["Yes",str(x)+" "+str(D-x)])
for i in range(Q):
    for k in answers[i]:
        print(k)
0