結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー | 👑 timi |
提出日時 | 2023-10-06 22:34:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 689 bytes |
コンパイル時間 | 452 ms |
コンパイル使用メモリ | 86,912 KB |
実行使用メモリ | 80,056 KB |
最終ジャッジ日時 | 2023-10-06 22:34:10 |
合計ジャッジ時間 | 1,852 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 116 ms
80,056 KB |
testcase_01 | AC | 129 ms
79,992 KB |
testcase_02 | AC | 123 ms
79,900 KB |
testcase_03 | AC | 125 ms
79,972 KB |
testcase_04 | AC | 134 ms
76,928 KB |
ソースコード
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()))