結果

問題 No.24 数当てゲーム
ユーザー バカらっくバカらっく
提出日時 2019-09-02 00:38:55
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 323 ms / 5,000 ms
コード長 877 bytes
コンパイル時間 14,247 ms
コンパイル使用メモリ 434,760 KB
実行使用メモリ 57,048 KB
最終ジャッジ日時 2024-05-07 10:27:06
合計ジャッジ時間 17,513 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 321 ms
56,896 KB
testcase_01 AC 322 ms
57,020 KB
testcase_02 AC 322 ms
56,816 KB
testcase_03 AC 322 ms
57,044 KB
testcase_04 AC 320 ms
56,896 KB
testcase_05 AC 322 ms
56,904 KB
testcase_06 AC 318 ms
56,780 KB
testcase_07 AC 323 ms
57,048 KB
testcase_08 AC 315 ms
57,016 KB
testcase_09 AC 320 ms
57,028 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun main(args: Array<String>) {
    val inputCount = readLine()!!.toInt()
    val noList = mutableSetOf<Int>()
    val yesList = mutableListOf<Int>()
    (1..inputCount).forEach {
        val inpt = readLine()!!.split(" ")
        val list = inpt.dropLast(1).map { it.toInt() }
        if(inpt.last().equals("NO")) {
            noList.addAll(list)
        } else {
            if(yesList.size == 0) {
                yesList.addAll(list)
            } else {
                val tmp = yesList.filter { list.contains(it) }
                yesList.clear()
                yesList.addAll(tmp)
            }
        }
    }
    val tmp = yesList.filter { !noList.contains(it) }
    yesList.clear()
    yesList.addAll(tmp)
    val target = (0..9).filter { !noList.contains(it) }
    if(target.size == 1) {
        println(target[0])
        return
    }
    println(yesList[0])
}

0