結果
問題 | No.1439 Let's Compare!!!! |
ユーザー | tamato |
提出日時 | 2021-03-26 21:37:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 683 ms / 2,000 ms |
コード長 | 2,380 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,516 KB |
実行使用メモリ | 109,160 KB |
最終ジャッジ日時 | 2024-11-29 08:38:04 |
合計ジャッジ時間 | 7,097 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,952 KB |
testcase_01 | AC | 37 ms
54,240 KB |
testcase_02 | AC | 34 ms
53,216 KB |
testcase_03 | AC | 35 ms
54,716 KB |
testcase_04 | AC | 37 ms
53,140 KB |
testcase_05 | AC | 35 ms
53,124 KB |
testcase_06 | AC | 33 ms
53,664 KB |
testcase_07 | AC | 105 ms
78,324 KB |
testcase_08 | AC | 159 ms
79,404 KB |
testcase_09 | AC | 96 ms
78,060 KB |
testcase_10 | AC | 627 ms
104,608 KB |
testcase_11 | AC | 683 ms
109,160 KB |
testcase_12 | AC | 586 ms
106,580 KB |
testcase_13 | AC | 638 ms
105,988 KB |
testcase_14 | AC | 633 ms
106,700 KB |
testcase_15 | AC | 598 ms
107,412 KB |
testcase_16 | AC | 542 ms
102,924 KB |
testcase_17 | AC | 558 ms
103,880 KB |
testcase_18 | AC | 271 ms
97,948 KB |
ソースコード
mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i def lower_bound(self, w): if w <= 0: return 0 x = 0 k = 1 << (self.size.bit_length() - 1) while k: if x + k <= self.size and self.tree[x + k] < w: w -= self.tree[x + k] x += k k >>= 1 return x + 1 N = int(input()) S = input().rstrip('\n') T = input().rstrip('\n') S = [s for s in S] T = [t for t in T] bit_S = Bit(N) bit_T = Bit(N) for i in range(N): s = int(S[i]) t = int(T[i]) if s > t: bit_S.add(i+1, 1) elif s < t: bit_T.add(i+1, 1) for _ in range(int(input())): c, x, y = input().split() x = int(x) S_large = 0 s = int(S[x - 1]) t = int(T[x - 1]) if s > t: S_large = 1 elif s < t: S_large = -1 if c == "S": S[x-1] = y else: T[x-1] = y s = int(S[x-1]) t = int(T[x-1]) if s > t: if S_large == 1: pass elif S_large == 0: bit_S.add(x, 1) else: bit_S.add(x, 1) bit_T.add(x, -1) elif s < t: if S_large == 1: bit_T.add(x, 1) bit_S.add(x, -1) elif S_large == 0: bit_T.add(x, 1) else: pass else: if S_large == 1: bit_S.add(x, -1) elif S_large == 0: pass else: bit_T.add(x, -1) js = bit_S.lower_bound(1) jt = bit_T.lower_bound(1) if js < jt: print(">") elif js > jt: print("<") else: print("=") if __name__ == '__main__': main()