結果

問題 No.1439 Let's Compare!!!!
ユーザー first_vilfirst_vil
提出日時 2021-03-09 15:41:19
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 995 ms / 2,000 ms
コード長 1,174 bytes
コンパイル時間 14,483 ms
コンパイル使用メモリ 418,944 KB
実行使用メモリ 74,060 KB
最終ジャッジ日時 2023-08-19 15:07:24
合計ジャッジ時間 26,569 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
50,220 KB
testcase_01 AC 237 ms
50,196 KB
testcase_02 AC 238 ms
50,276 KB
testcase_03 AC 242 ms
52,056 KB
testcase_04 AC 242 ms
50,692 KB
testcase_05 AC 238 ms
50,508 KB
testcase_06 AC 235 ms
50,444 KB
testcase_07 AC 358 ms
54,944 KB
testcase_08 AC 365 ms
55,080 KB
testcase_09 AC 326 ms
54,944 KB
testcase_10 AC 808 ms
65,568 KB
testcase_11 AC 955 ms
67,916 KB
testcase_12 AC 944 ms
73,380 KB
testcase_13 AC 796 ms
69,028 KB
testcase_14 AC 808 ms
69,284 KB
testcase_15 AC 737 ms
70,160 KB
testcase_16 AC 925 ms
74,060 KB
testcase_17 AC 995 ms
72,136 KB
testcase_18 AC 694 ms
65,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve() {
    val n = nextInt()
    var s = next().toCharArray()
    var t = next().toCharArray()

    var pq = PriorityQueue<Int>()
    for (i in 0 until n) if (s[i] != t[i]) pq.add(i)

    repeat(nextInt()) {
        val c = next()
        val x = nextInt() - 1
        if (c == "S") s[x] = ('0' + nextInt()).toChar()
        else t[x] = ('0' + nextInt()).toChar()
        if (s[x] != t[x]) pq.add(x)

        while (pq.isNotEmpty() && s[pq.peek()] == t[pq.peek()]) pq.remove()

        if (pq.isEmpty()) println('=')
        else {
            val i = pq.peek()
            println(if (s[i] < t[i]) { '<' } else { '>' })
        }
    }
}

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