結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー | miya145592 |
提出日時 | 2023-10-06 22:45:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 460 bytes |
コンパイル時間 | 369 ms |
コンパイル使用メモリ | 86,932 KB |
実行使用メモリ | 76,568 KB |
最終ジャッジ日時 | 2023-10-06 22:45:45 |
合計ジャッジ時間 | 1,512 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
75,232 KB |
testcase_01 | AC | 90 ms
76,568 KB |
testcase_02 | AC | 93 ms
76,352 KB |
testcase_03 | AC | 90 ms
76,468 KB |
testcase_04 | AC | 73 ms
71,192 KB |
ソースコード
import sys input = sys.stdin.readline Q = int(input()) DK = [list(map(int, input().split())) for _ in range(Q)] for d, k in DK: S = [] for x in range(-d, d+1): y = d-abs(x) dist = x**2+y**2 S.append((x, y, dist)) if y!=0: S.append((x, -y, dist)) S.sort(key=lambda x:x[2]) #print(S) if len(S)<k: print("No") continue x, y = S[k-1][0], S[k-1][1] print("Yes") print(x, y)