結果

問題 No.2493 K-th in L2 with L1
ユーザー hato336hato336
提出日時 2023-10-06 21:47:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 76,536 KB
最終ジャッジ日時 2023-10-06 21:47:56
合計ジャッジ時間 1,493 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,980 KB
testcase_01 AC 80 ms
76,220 KB
testcase_02 AC 83 ms
76,400 KB
testcase_03 AC 80 ms
76,536 KB
testcase_04 AC 73 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    d,k = map(int,input().split())
    if d == 0 and k == 1:
        print('Yes')
        print(0,0)
        continue
    z = d * 4
    if k > z:
        print('No')
    else:
        print('Yes')
        ans = []
        x,y = 0,d
        for i in range(d//2):
            a = 8
            if i == 0:
                a = 4
            for j in range(a):
                ans.append((x,y))
            x += 1
            y -= 1
        a = 4
        if d % 2 == 1:
            a = 8
        for j in range(a):
            ans.append((x,y))
        ans.reverse()
        print(*ans[k-1])
        
0