結果

問題 No.2493 K-th in L2 with L1
ユーザー pitPpitP
提出日時 2023-10-06 21:40:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 80,304 KB
最終ジャッジ日時 2023-10-06 21:40:03
合計ジャッジ時間 2,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 100 ms
72,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key
Q = int(input())

for _ in range(Q):
    D, K = map(int,input().split())
    points = []
    for i in range(-D, D + 1):
        points.append([i, D - abs(i)])
        if abs(i) != D : points.append([i, -(D - abs(i))])
    
    if len(points) < K :
        print("No")
    else:
        print("Yes")
        def cmp(a, b):
            return (a[0] ** 2 + a[1] ** 2) < (b[0] ** 2 + b[1] ** 2)
        
        points.sort(key=cmp_to_key(cmp))
        print(*points[K - 1])
0