結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー |
![]() |
提出日時 | 2023-10-06 21:41:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 66 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 67,712 KB |
最終ジャッジ日時 | 2024-07-26 15:53:58 |
合計ジャッジ時間 | 889 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
for _ in range(int(input())):d,k=map(int,input().split())if d==0:if k==1:print("Yes")print(0,0)continueelse:print("No")continuep=[]for i in range(d):g=i**2+(d-i)**2p+=[(g,i,d-i)]p+=[(g,-i,-d+i)]p+=[(g,d-i,-i)]p+=[(g,-d+i,i)]p.sort()l=0r=0f=0while l<len(p):while r+1<len(p) and p[r+1][0]==p[l][0]:r+=1if l<k and r+1>=k and f==0:f=1print("Yes")print(*p[l][1:])l=r+1r=lif f==0:print("No")