結果

問題 No.2493 K-th in L2 with L1
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-10-06 21:25:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,348 KB
実行使用メモリ 76,500 KB
最終ジャッジ日時 2023-10-06 21:25:23
合計ジャッジ時間 1,430 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,280 KB
testcase_01 AC 97 ms
76,216 KB
testcase_02 AC 90 ms
76,500 KB
testcase_03 AC 89 ms
76,436 KB
testcase_04 AC 70 ms
71,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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