結果

問題 No.2493 K-th in L2 with L1
ユーザー matt rohmatt roh
提出日時 2023-10-06 21:43:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 11,576 KB
実行使用メモリ 15,268 KB
最終ジャッジ日時 2023-10-06 21:43:25
合計ジャッジ時間 1,337 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,120 KB
testcase_01 AC 81 ms
15,184 KB
testcase_02 AC 80 ms
15,100 KB
testcase_03 AC 91 ms
15,032 KB
testcase_04 AC 79 ms
15,268 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets.to_i.times do
    d,x=gets.split.map &:to_i
    if d==0
        if x==1
            puts "Yes\n0 0"
        else
            puts "No"
        end
        next
    end
    b=((d+1)/2..d).bsearch{|v|[v-(d-v)+1,0].max*4>=x}||d
    if [b,(d-b)+1,0].max*4>=x&&[b-(d-b)-1,0].max*4<x
        puts "Yes"
        puts [b,d-b]*" "
    else
        puts "No"
    end
end
0