結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー |
👑 |
提出日時 | 2023-10-06 21:25:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 492 bytes |
コンパイル時間 | 278 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 63,504 KB |
最終ジャッジ日時 | 2024-07-26 15:42:00 |
合計ジャッジ時間 | 981 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
def solve(): n, k = map(int, input().split()) lst = [] for i in range(n + 1): j = n - i lst.append((i, j)) if j != 0: lst.append((i, -j)) if i != 0: lst.append((-i, -j)) if j != 0: lst.append((-i, -j)) if k > len(lst): print("No") return lst.sort(key=lambda x: x[0] * x[0] + x[1] * x[1]) print("Yes") print(*lst[k - 1]) for _ in range(int(input())): solve()