結果

問題 No.2155 みちらcolor
ユーザー 👑 箱星箱星
提出日時 2022-12-09 21:42:27
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 457 ms / 2,000 ms
コード長 1,138 bytes
コンパイル時間 17,384 ms
コンパイル使用メモリ 435,224 KB
実行使用メモリ 61,500 KB
最終ジャッジ日時 2024-04-22 21:29:41
合計ジャッジ時間 47,295 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 423 ms
61,188 KB
testcase_01 AC 421 ms
58,812 KB
testcase_02 AC 449 ms
57,328 KB
testcase_03 AC 412 ms
57,908 KB
testcase_04 AC 411 ms
58,012 KB
testcase_05 AC 412 ms
59,320 KB
testcase_06 AC 404 ms
56,140 KB
testcase_07 AC 389 ms
55,216 KB
testcase_08 AC 444 ms
58,768 KB
testcase_09 AC 418 ms
59,248 KB
testcase_10 AC 396 ms
56,680 KB
testcase_11 AC 404 ms
57,060 KB
testcase_12 AC 410 ms
58,744 KB
testcase_13 AC 368 ms
54,048 KB
testcase_14 AC 431 ms
59,636 KB
testcase_15 AC 370 ms
54,196 KB
testcase_16 AC 417 ms
56,772 KB
testcase_17 AC 385 ms
54,720 KB
testcase_18 AC 423 ms
58,576 KB
testcase_19 AC 406 ms
59,092 KB
testcase_20 AC 433 ms
60,552 KB
testcase_21 AC 425 ms
61,020 KB
testcase_22 AC 417 ms
59,652 KB
testcase_23 AC 414 ms
59,204 KB
testcase_24 AC 428 ms
60,840 KB
testcase_25 AC 423 ms
60,948 KB
testcase_26 AC 429 ms
60,596 KB
testcase_27 AC 448 ms
60,976 KB
testcase_28 AC 421 ms
59,676 KB
testcase_29 AC 426 ms
59,892 KB
testcase_30 AC 424 ms
60,012 KB
testcase_31 AC 445 ms
60,340 KB
testcase_32 AC 418 ms
60,340 KB
testcase_33 AC 422 ms
60,504 KB
testcase_34 AC 428 ms
60,556 KB
testcase_35 AC 444 ms
59,976 KB
testcase_36 AC 414 ms
60,320 KB
testcase_37 AC 440 ms
61,140 KB
testcase_38 AC 457 ms
59,984 KB
testcase_39 AC 428 ms
60,772 KB
testcase_40 AC 426 ms
61,500 KB
testcase_41 AC 428 ms
61,060 KB
testcase_42 AC 368 ms
54,076 KB
testcase_43 AC 357 ms
53,908 KB
testcase_44 AC 365 ms
54,108 KB
testcase_45 AC 364 ms
53,972 KB
testcase_46 AC 360 ms
54,104 KB
testcase_47 AC 397 ms
54,780 KB
testcase_48 AC 385 ms
54,792 KB
testcase_49 AC 358 ms
54,068 KB
testcase_50 AC 388 ms
54,860 KB
testcase_51 AC 386 ms
54,740 KB
testcase_52 AC 383 ms
54,896 KB
testcase_53 AC 385 ms
54,712 KB
testcase_54 AC 390 ms
54,572 KB
testcase_55 AC 357 ms
54,016 KB
testcase_56 AC 370 ms
54,600 KB
testcase_57 AC 361 ms
53,900 KB
testcase_58 AC 360 ms
54,112 KB
testcase_59 AC 363 ms
54,128 KB
testcase_60 AC 358 ms
54,112 KB
testcase_61 AC 369 ms
54,156 KB
testcase_62 AC 385 ms
54,668 KB
testcase_63 AC 363 ms
54,228 KB
testcase_64 AC 376 ms
54,232 KB
testcase_65 AC 360 ms
53,968 KB
testcase_66 AC 367 ms
54,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val m = nextInt()
    val l = nextInt()
    val a = Array(n) { nextInt() }
    var set = mutableSetOf(l)
    for (i in 0 until n) {
        val set2 = mutableSetOf<Int>()
        for (c in set) {
            set2.add(c)
            set2.add((c + a[i]) / 2)
        }
        set = set2
    }
    println(if (set.contains(m)) "Yes" else "No")
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0