結果
問題 | No.1439 Let's Compare!!!! |
ユーザー | tamato |
提出日時 | 2021-03-26 21:37:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 794 ms / 2,000 ms |
コード長 | 2,380 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 82,256 KB |
実行使用メモリ | 108,896 KB |
最終ジャッジ日時 | 2024-05-06 22:15:53 |
合計ジャッジ時間 | 8,737 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
52,984 KB |
testcase_01 | AC | 41 ms
54,364 KB |
testcase_02 | AC | 45 ms
54,064 KB |
testcase_03 | AC | 39 ms
53,768 KB |
testcase_04 | AC | 44 ms
53,676 KB |
testcase_05 | AC | 43 ms
54,360 KB |
testcase_06 | AC | 44 ms
53,524 KB |
testcase_07 | AC | 130 ms
78,260 KB |
testcase_08 | AC | 187 ms
79,280 KB |
testcase_09 | AC | 113 ms
77,612 KB |
testcase_10 | AC | 776 ms
104,732 KB |
testcase_11 | AC | 794 ms
108,896 KB |
testcase_12 | AC | 682 ms
106,624 KB |
testcase_13 | AC | 770 ms
105,724 KB |
testcase_14 | AC | 787 ms
106,956 KB |
testcase_15 | AC | 769 ms
107,656 KB |
testcase_16 | AC | 668 ms
102,616 KB |
testcase_17 | AC | 671 ms
104,008 KB |
testcase_18 | AC | 313 ms
98,048 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()