結果

問題 No.2493 K-th in L2 with L1
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-10-06 22:16:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 76,492 KB
最終ジャッジ日時 2023-10-06 22:16:47
合計ジャッジ時間 1,374 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,624 KB
testcase_01 AC 93 ms
76,344 KB
testcase_02 AC 94 ms
76,492 KB
testcase_03 AC 91 ms
76,360 KB
testcase_04 AC 70 ms
71,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    d,k = map(int,input().split())

    cand = set()

    for i in range(-d,d+1):
        dif = d - abs(i)
        cand.add((i,dif))
        cand.add((i,-dif))

    lis = []
    for x,y in cand:
        dis = x**2+y**2
        lis.append([dis,x,y])

    lis.sort()

    if len(lis) < k:
        print("No")
    else:
        print("Yes")
        x,y = lis[k-1][1:]
        print(x,y)
    return 

q = int(input())
for _ in range(q):
    solve()
0