結果

問題 No.2044 Infinite Nim
ユーザー 👑 箱
提出日時 2021-10-22 17:57:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 442 ms / 2,000 ms
コード長 882 bytes
コンパイル時間 14,049 ms
コンパイル使用メモリ 438,416 KB
実行使用メモリ 63,108 KB
最終ジャッジ日時 2024-04-17 11:55:52
合計ジャッジ時間 27,456 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
49,736 KB
testcase_01 AC 281 ms
49,808 KB
testcase_02 AC 273 ms
49,852 KB
testcase_03 AC 278 ms
49,784 KB
testcase_04 AC 274 ms
49,744 KB
testcase_05 AC 276 ms
49,724 KB
testcase_06 AC 276 ms
49,732 KB
testcase_07 AC 280 ms
49,644 KB
testcase_08 AC 280 ms
49,900 KB
testcase_09 AC 270 ms
49,972 KB
testcase_10 AC 270 ms
49,876 KB
testcase_11 AC 291 ms
49,736 KB
testcase_12 AC 272 ms
49,792 KB
testcase_13 AC 431 ms
55,576 KB
testcase_14 AC 396 ms
53,208 KB
testcase_15 AC 387 ms
52,712 KB
testcase_16 AC 413 ms
53,400 KB
testcase_17 AC 421 ms
57,620 KB
testcase_18 AC 385 ms
52,608 KB
testcase_19 AC 397 ms
52,864 KB
testcase_20 AC 418 ms
55,020 KB
testcase_21 AC 419 ms
58,252 KB
testcase_22 AC 409 ms
55,156 KB
testcase_23 AC 401 ms
53,496 KB
testcase_24 AC 422 ms
56,492 KB
testcase_25 AC 428 ms
54,396 KB
testcase_26 AC 418 ms
57,492 KB
testcase_27 AC 380 ms
53,024 KB
testcase_28 AC 442 ms
58,684 KB
testcase_29 AC 401 ms
55,212 KB
testcase_30 AC 413 ms
56,052 KB
testcase_31 AC 424 ms
59,504 KB
testcase_32 AC 429 ms
59,524 KB
testcase_33 AC 424 ms
59,696 KB
testcase_34 AC 400 ms
57,208 KB
testcase_35 AC 435 ms
63,108 KB
testcase_36 AC 269 ms
49,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fun PrintWriter.solve() {
    val n = nextInt()
    val a = Array(n) { nextInt() }
    val inf = a.count { it == -1 }
    if (inf % 2 == 1) {
        println("First")
        return
    }
    var x = 0
    for (i in 0 until n) {
        if (a[i] != -1) {
            x = x xor a[i]
        }
    }
    println(if (x == 0) "Second" else "First")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// 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