結果
問題 | No.1439 Let's Compare!!!! |
ユーザー | rlangevin |
提出日時 | 2023-01-19 22:52:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 489 ms / 2,000 ms |
コード長 | 1,255 bytes |
コンパイル時間 | 1,825 ms |
コンパイル使用メモリ | 86,868 KB |
実行使用メモリ | 136,264 KB |
最終ジャッジ日時 | 2023-09-04 16:48:55 |
合計ジャッジ時間 | 9,013 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
71,484 KB |
testcase_01 | AC | 80 ms
71,316 KB |
testcase_02 | AC | 79 ms
71,164 KB |
testcase_03 | AC | 78 ms
71,528 KB |
testcase_04 | AC | 79 ms
71,136 KB |
testcase_05 | AC | 79 ms
71,280 KB |
testcase_06 | AC | 79 ms
71,324 KB |
testcase_07 | AC | 143 ms
78,556 KB |
testcase_08 | AC | 163 ms
79,292 KB |
testcase_09 | AC | 123 ms
77,892 KB |
testcase_10 | AC | 452 ms
135,056 KB |
testcase_11 | AC | 398 ms
123,148 KB |
testcase_12 | AC | 339 ms
122,932 KB |
testcase_13 | AC | 451 ms
135,068 KB |
testcase_14 | AC | 456 ms
136,264 KB |
testcase_15 | AC | 363 ms
122,832 KB |
testcase_16 | AC | 399 ms
123,472 KB |
testcase_17 | AC | 489 ms
122,692 KB |
testcase_18 | AC | 265 ms
122,828 KB |
ソースコード
import sys readline = sys.stdin.readline from heapq import * class QuasiBinaryTree: def __init__(self, rule="min"): if rule == "max": self.pm = -1 else: self.pm = 1 self.inf = 10**18 self.P = [self.inf] self.Q = [] def insert(self, x): heappush(self.P, x * self.pm) def erase(self, x): heappush(self.Q, x * self.pm) def top(self): while self.Q and (self.P[0] == self.Q[0]): heappop(self.P) heappop(self.Q) return self.P[0] * self.pm N = int(readline()) S = list(input().rstrip()) T = list(input().rstrip()) S = list(map(int, S)) T = list(map(int, T)) BT = QuasiBinaryTree("min") BT.insert(N) for i in range(N): if S[i] != T[i]: BT.insert(i) Q = int(readline()) for _ in range(Q): c, x, y = readline().split() x = int(x) - 1 y = int(y) pre = int(S[x] == T[x]) if c == "S": S[x] = y else: T[x] = y now = int(S[x] == T[x]) if pre != now: if now: BT.erase(x) else: BT.insert(x) ind = BT.top() if ind == N: print("=") elif S[ind] > T[ind]: print(">") else: print("<")