結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-06 22:42:15 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 973 bytes |
| コンパイル時間 | 1,176 ms |
| コンパイル使用メモリ | 32,000 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-26 16:44:52 |
| 合計ジャッジ時間 | 1,696 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
program yukicoder_2493
use, intrinsic :: iso_fortran_env
implicit none
integer(int32) :: q, d, k
integer(int32) :: lt_points, le_points
integer(int32) :: x, y
integer(int32) :: i
read(input_unit, *) q
query: do i = 1, q
read(input_unit, *) d, k
if (d == 0) then
if (k == 1) then
write(output_unit, '(a)') "Yes"
write(output_unit, '(*(i0, 1x))') 0, 0
else
write(output_unit, '(a)') "No"
end if
cycle query
end if
lt_points = 0_int32
le_points = 0_int32
do x = d / 2, 0, -1
y = d - x
lt_points = le_points
le_points = le_points + merge(4, 8, 2 * x == d .or. x == 0)
if (lt_points < k .and. le_points >= k) then
write(output_unit, '(a)') "Yes"
write(output_unit, '(*(i0, 1x))') x, y
cycle query
end if
end do
write(output_unit, '(a)') "No"
end do query
end program yukicoder_2493