結果

問題 No.1439 Let's Compare!!!!
ユーザー first_vilfirst_vil
提出日時 2021-03-09 15:49:03
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,227 bytes
コンパイル時間 15,980 ms
コンパイル使用メモリ 441,332 KB
実行使用メモリ 86,372 KB
最終ジャッジ日時 2024-04-19 20:16:15
合計ジャッジ時間 21,038 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

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)

    var ans = String()
    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()) ans += "=\n"
        else {
            val i = pq.peek()
            if (s[i] < t[i]) ans += "<\n"
            else ans += ">\n"
        }
    }
    println(ans)
}

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