結果

問題 No.2155 みちらcolor
ユーザー 👑 箱
提出日時 2022-12-09 21:42:27
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 1,138 bytes
コンパイル時間 15,414 ms
コンパイル使用メモリ 422,856 KB
実行使用メモリ 61,148 KB
最終ジャッジ日時 2023-08-04 23:06:39
合計ジャッジ時間 41,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 344 ms
57,452 KB
testcase_01 AC 332 ms
59,080 KB
testcase_02 AC 355 ms
61,148 KB
testcase_03 AC 338 ms
59,384 KB
testcase_04 AC 336 ms
58,968 KB
testcase_05 AC 348 ms
59,028 KB
testcase_06 AC 337 ms
59,208 KB
testcase_07 AC 311 ms
59,020 KB
testcase_08 AC 360 ms
57,220 KB
testcase_09 AC 342 ms
58,912 KB
testcase_10 AC 341 ms
57,368 KB
testcase_11 AC 342 ms
59,228 KB
testcase_12 AC 345 ms
57,528 KB
testcase_13 AC 293 ms
58,192 KB
testcase_14 AC 363 ms
57,160 KB
testcase_15 AC 289 ms
56,356 KB
testcase_16 AC 337 ms
57,272 KB
testcase_17 AC 309 ms
57,008 KB
testcase_18 AC 339 ms
59,040 KB
testcase_19 AC 339 ms
57,200 KB
testcase_20 AC 347 ms
57,308 KB
testcase_21 AC 350 ms
59,400 KB
testcase_22 AC 347 ms
57,148 KB
testcase_23 AC 345 ms
59,000 KB
testcase_24 AC 356 ms
57,512 KB
testcase_25 AC 353 ms
59,152 KB
testcase_26 AC 363 ms
59,024 KB
testcase_27 AC 363 ms
57,308 KB
testcase_28 AC 348 ms
59,036 KB
testcase_29 AC 350 ms
59,320 KB
testcase_30 AC 360 ms
57,200 KB
testcase_31 AC 362 ms
59,412 KB
testcase_32 AC 357 ms
57,156 KB
testcase_33 AC 359 ms
57,228 KB
testcase_34 AC 358 ms
57,324 KB
testcase_35 AC 370 ms
57,504 KB
testcase_36 AC 347 ms
57,144 KB
testcase_37 AC 372 ms
57,208 KB
testcase_38 AC 356 ms
57,240 KB
testcase_39 AC 348 ms
57,180 KB
testcase_40 AC 349 ms
57,136 KB
testcase_41 AC 349 ms
59,388 KB
testcase_42 AC 300 ms
60,128 KB
testcase_43 AC 295 ms
58,264 KB
testcase_44 AC 292 ms
56,180 KB
testcase_45 AC 295 ms
56,232 KB
testcase_46 AC 288 ms
56,304 KB
testcase_47 AC 318 ms
58,988 KB
testcase_48 AC 317 ms
59,124 KB
testcase_49 AC 291 ms
58,192 KB
testcase_50 AC 317 ms
59,076 KB
testcase_51 AC 323 ms
59,268 KB
testcase_52 AC 316 ms
58,428 KB
testcase_53 AC 315 ms
57,132 KB
testcase_54 AC 317 ms
60,256 KB
testcase_55 AC 296 ms
56,528 KB
testcase_56 AC 321 ms
59,008 KB
testcase_57 AC 299 ms
58,356 KB
testcase_58 AC 296 ms
56,264 KB
testcase_59 AC 290 ms
58,164 KB
testcase_60 AC 296 ms
58,076 KB
testcase_61 AC 298 ms
58,076 KB
testcase_62 AC 325 ms
58,856 KB
testcase_63 AC 299 ms
56,396 KB
testcase_64 AC 297 ms
56,140 KB
testcase_65 AC 292 ms
56,156 KB
testcase_66 AC 298 ms
58,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