結果

問題 No.2493 K-th in L2 with L1
ユーザー kokomi_ckokomi_c
提出日時 2023-10-06 22:07:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 71,728 KB
最終ジャッジ日時 2023-10-06 22:07:04
合計ジャッジ時間 1,603 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,172 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 70 ms
71,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = int(input())

for q in range(Q):
    D, K = map(int, input().split())

    if D == 0:
        if K == 1:
            print("Yes")
            print(0, 0)
        else:
            print("No")
        continue

    if D * 4 < K:
        print("No")
        continue

    K -= 1
    if D % 2 == 0:
        if K <= 4:
            temp = 0
        
        else:
            temp = ((K - 4) // 8) + 1

        print("Yes")
        print((D // 2) + temp, (D // 2) - temp)

    elif D % 2 == 1:
        temp = K // 8
        print("Yes")
        print(D - ((D - 1) - temp), ((D - 1) - temp))
0