結果
問題 | No.1465 Archaea |
ユーザー |
![]() |
提出日時 | 2023-01-26 22:14:16 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 457 ms / 2,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 11,928 ms |
コンパイル使用メモリ | 437,600 KB |
実行使用メモリ | 84,900 KB |
最終ジャッジ日時 | 2024-06-27 13:07:28 |
合計ジャッジ時間 | 21,493 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
import java.util.LinkedListfun main(args: Array<String>) {val (n,k) = readLine()!!.split(" ").map { it.toInt() }val stetps = arrayOfNulls<Int>(n+1)val queue = LinkedList<Int>()queue.add(1)stetps[1] = 0while (queue.isNotEmpty()) {val cur = queue.pop()val nextStep = stetps[cur]!! + 1val nextList = listOf(cur*2, cur+3).filter { it <= n }for(next in nextList) {if(stetps[next] == null || stetps[next]!! > nextStep) {stetps[next] = nextStepqueue.add(next)}}}println(if((stetps[n] ?: (k + 1)) > k) "NO" else "YES")}