結果

問題 No.2493 K-th in L2 with L1
ユーザー misonikomipan
提出日時 2023-10-06 22:00:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-26 16:06:34
合計ジャッジ時間 1,141 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 3 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(d, k):
  ans = []
  if (4*d < k):
    print("No")
    return
  for x in range(d):
    dist = x**2 + (d-x)**2
    ans.append([dist, x, d-x])
    ans.append([dist, x, x-d])
    ans.append([dist, -x, d-x])
    ans.append([dist, -x, x-d])
  ans.sort()
  #print(ans)
  _, x, y = ans[k-1]
  print("Yes")
  print(x, y)
Q = int(input())
ans =-1
for item in range(Q):
	d, k = map(int, input().split())
	solve(d, k)
0