結果

問題 No.1439 Let's Compare!!!!
ユーザー titiatitia
提出日時 2021-03-26 22:10:26
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 655 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 23,204 KB
最終ジャッジ日時 2023-08-19 15:21:24
合計ジャッジ時間 8,002 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,072 KB
testcase_01 AC 13 ms
8,096 KB
testcase_02 AC 14 ms
8,068 KB
testcase_03 AC 14 ms
8,024 KB
testcase_04 AC 14 ms
8,128 KB
testcase_05 AC 14 ms
8,096 KB
testcase_06 AC 15 ms
8,164 KB
testcase_07 AC 30 ms
8,760 KB
testcase_08 AC 36 ms
8,680 KB
testcase_09 AC 21 ms
8,436 KB
testcase_10 AC 635 ms
23,204 KB
testcase_11 AC 567 ms
19,884 KB
testcase_12 AC 560 ms
19,488 KB
testcase_13 AC 655 ms
23,032 KB
testcase_14 AC 641 ms
23,000 KB
testcase_15 AC 568 ms
19,860 KB
testcase_16 AC 584 ms
19,028 KB
testcase_17 AC 595 ms
13,608 KB
testcase_18 AC 479 ms
13,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import heapq

N=int(input())
S=list(map(int,list(input().strip())))
T=list(map(int,list(input().strip())))

Q1=[]
Q2=[]

for i in range(N):
    if S[i]<T[i]:
        Q1.append(i)
    elif S[i]>T[i]:
        Q2.append(i)

Q=int(input())
for i in range(Q):
    c,x,y=input().split()
    x=int(x)-1
    y=int(y)

    if c=="S":
        S[x]=y
    else:
        T[x]=y

    if S[x]<T[x]:
        heapq.heappush(Q1,x)
    elif S[x]>T[x]:
        heapq.heappush(Q2,x)

    while Q1 and S[Q1[0]]>=T[Q1[0]]:
        heapq.heappop(Q1)

    while Q2 and S[Q2[0]]<=T[Q2[0]]:
        heapq.heappop(Q2)

    if Q1 and Q2:
        
        if Q1[0]<Q2[0]:
            print("<")
        elif Q2[0]<Q1[0]:
            print(">")

    elif Q1:
        print("<")
    elif Q2:
        print(">")
    else:
        print("=")
        

    





0