結果
| 問題 | No.2493 K-th in L2 with L1 | 
| コンテスト | |
| ユーザー |  timi | 
| 提出日時 | 2023-10-06 22:34:08 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 99 ms / 2,000 ms | 
| コード長 | 689 bytes | 
| コンパイル時間 | 391 ms | 
| コンパイル使用メモリ | 82,380 KB | 
| 実行使用メモリ | 78,832 KB | 
| 最終ジャッジ日時 | 2024-07-26 16:40:06 | 
| 合計ジャッジ時間 | 1,410 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 4 | 
ソースコード
Q=int(input())
D={};A=[]
for i in range(-100,101):
  for j in range(-100,101):
    d=abs(i)+abs(j)
    if d>100:
      continue
    if d not in D:
      D[d]=[]
    D[d].append((i**2+j**2,i,j))
    A.append(d)
for d in D:
  D[d]=sorted(D[d])
import bisect
for _ in range(Q):
  d,k=map(int, input().split())
  B=[];E=[]
  now=-1
  for a,x,y in D[d]:
    if a!=now:
      now=a
      B.append(1)
      E.append((x,y))
    else:
      B[-1]+=1 
  C=[0]
  for b in B:
    C.append(C[-1]+b)
  f=0
  for i in range(len(C)-1):
    x,y=C[i],C[i+1]
    if x<k and y>=k:
      f=1
      ans=E[i]
  if f==0:
    print('No')
  else:
    print('Yes')
    print(*ans)
#P=list(map(int,input().split()))
            
            
            
        