結果

問題 No.2493 K-th in L2 with L1
ユーザー FromBooskaFromBooska
提出日時 2023-10-06 21:43:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 815 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-10-06 21:43:05
合計ジャッジ時間 1,436 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,268 KB
testcase_01 AC 84 ms
76,604 KB
testcase_02 AC 89 ms
76,944 KB
testcase_03 AC 84 ms
76,564 KB
testcase_04 AC 73 ms
71,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# わかりにくい文章

T = int(input())
for t in range(T):
    d, k = map(int, input().split())
    count = [4]*(d+1)
    distance = [0]*(d+1)
    for i in range((d+1)//2, d+1):
        if i == d//2 or i == d:
            distance[i] = count[i]
        else:
            distance[i] = count[i]*2
    cumu = []
    temp = 0
    for i in range(d+1):
        temp += distance[i]
        cumu.append(temp)

    #print(count)
    #print(distance)
    #print(cumu)

    from bisect import *

    if d == 0:
        if k == 1:
            print('Yes')
            print(0, 0)
        else:
            print('No')
    else:
        if k > cumu[-1]:
            print('No')
        else:
            print('Yes')
            idx = bisect_left(cumu, k)
            x = idx
            y = d-idx
            print(x, y)
0