結果
問題 | No.1439 Let's Compare!!!! |
ユーザー |
|
提出日時 | 2021-03-09 15:49:03 |
言語 | Kotlin (2.1.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,227 bytes |
コンパイル時間 | 16,492 ms |
コンパイル使用メモリ | 448,220 KB |
実行使用メモリ | 92,336 KB |
最終ジャッジ日時 | 2024-10-11 12:28:09 |
合計ジャッジ時間 | 24,590 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 8 TLE * 1 -- * 8 |
ソースコード
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