結果

問題 No.2493 K-th in L2 with L1
ユーザー ShirotsumeShirotsume
提出日時 2023-10-06 21:25:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 79,900 KB
最終ジャッジ日時 2023-10-06 21:25:58
合計ジャッジ時間 1,658 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
79,816 KB
testcase_01 AC 128 ms
79,864 KB
testcase_02 AC 131 ms
79,784 KB
testcase_03 AC 131 ms
79,900 KB
testcase_04 AC 109 ms
74,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

for _ in range(ii()):
    d, k = mi()
    X = []
    for x in range(-d - 1, d + 1):
        if abs(x) + abs((d - abs(x))) == d:
            X.append((x, (d - abs(x))))
            X.append((x, -(d - abs(x))))
    X = list(set(X))
    X.sort(key = lambda x: x[0] ** 2 + x[1] ** 2)
    
    if len(X) < k:
        print('No')
    else:
        print('Yes')
        print(*X[k-1])
0