結果

問題 No.2080 Simple Nim Query
ユーザー 👑 箱星箱星
提出日時 2022-09-25 21:33:12
言語 Kotlin
(1.9.23)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,279 bytes
コンパイル時間 15,396 ms
コンパイル使用メモリ 426,296 KB
実行使用メモリ 88,004 KB
最終ジャッジ日時 2023-09-03 02:48:46
合計ジャッジ時間 23,546 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 236 ms
57,584 KB
testcase_01 AC 244 ms
88,004 KB
testcase_02 AC 250 ms
56,916 KB
testcase_03 AC 560 ms
60,344 KB
testcase_04 AC 576 ms
58,656 KB
testcase_05 AC 722 ms
66,632 KB
testcase_06 AC 911 ms
68,548 KB
testcase_07 AC 924 ms
68,716 KB
testcase_08 AC 657 ms
62,492 KB
testcase_09 AC 668 ms
60,592 KB
testcase_10 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fun PrintWriter.solve() {
    val n = nextInt()
    val q = nextInt()
    val a = Array(n) { nextInt() }
    for (_i in 0 until q) {
        val t = nextInt()
        val x = nextInt()
        val y = nextInt()
        if (t == 1) {
            a[x - 1] = y
        } else {
            var count = 0
            for (i in y - 1 downTo x - 1) {
                if (a[i] == 1) count++
                else break
                if (i == x - 1) count++
            }
            println(if (count % 2 == 0) "F" else "S")
        }
    }
}

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