結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-06 21:46:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-07-26 15:57:37 |
| 合計ジャッジ時間 | 845 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
def solve(d, k):
if k == 1 or k <= 4 * d:
print("Yes")
print(*points[d][k-1])
else:
print("No")
points = [None for _ in range(101)]
points[0] = [(0, 0)]
for d in range(1, 101):
points[d] = [(0, d), (0, -d), (d, 0), (-d, 0)]
for x in range(1, d):
points[d].append((x, d - x))
points[d].append((x, -d + x))
points[d].append((-x, d - x))
points[d].append((-x, -d + x))
points[d].sort(key=lambda a: a[0] * a[0] + a[1] * a[1])
q = int(input())
for _ in range(q):
di, ki = [int(x) for x in input().split()]
solve(di, ki)