結果
| 問題 |
No.1439 Let's Compare!!!!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-09 15:41:19 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 1,049 ms / 2,000 ms |
| コード長 | 1,174 bytes |
| コンパイル時間 | 16,488 ms |
| コンパイル使用メモリ | 446,608 KB |
| 実行使用メモリ | 97,896 KB |
| 最終ジャッジ日時 | 2024-11-29 08:33:15 |
| 合計ジャッジ時間 | 23,788 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
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