結果

問題 No.1439 Let's Compare!!!!
ユーザー GER_chenGER_chen
提出日時 2021-03-26 22:23:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 3,113 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 102,828 KB
最終ジャッジ日時 2023-08-19 08:53:29
合計ジャッジ時間 7,905 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,492 KB
testcase_01 AC 61 ms
71,124 KB
testcase_02 AC 62 ms
71,404 KB
testcase_03 AC 62 ms
71,156 KB
testcase_04 AC 63 ms
71,112 KB
testcase_05 AC 62 ms
71,324 KB
testcase_06 AC 62 ms
71,244 KB
testcase_07 AC 93 ms
77,896 KB
testcase_08 AC 104 ms
78,116 KB
testcase_09 AC 83 ms
76,884 KB
testcase_10 AC 262 ms
99,288 KB
testcase_11 AC 190 ms
98,308 KB
testcase_12 AC 198 ms
99,304 KB
testcase_13 AC 270 ms
98,316 KB
testcase_14 AC 273 ms
98,300 KB
testcase_15 AC 182 ms
98,312 KB
testcase_16 AC 193 ms
98,248 KB
testcase_17 WA -
testcase_18 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
S = list(map(int, input()))
T = list(map(int, input()))

D = [S[i]-T[i] for i in range(n)]

status = 'e'
checked = 0
for d in D:
    if d > 0:
        status = 's'
        break
    elif d < 0:
        status = 't'
        break
    else:
        checked += 1
q = int(input())
Ans = [None]*q       
for j in range(q):
    c, x, y = input().split()
    x, y = int(x), int(y)
    if c == 'S':
        df = y-S[x-1]
        if df:
            D[x-1] += df
            S[x-1] = y
            if status == 'e':
                checked = x
                if df > 0:
                    status = 's'
                else:
                    status = 't'
            elif status == 's':
                if checked >= x-1:
                    checked = x-1
                    for i in range(x-1, n):
                        d = D[i]
                        if d > 0:
                            break
                        elif d < 0:
                            status = 't'
                            break
                        else:
                            checked += 1
                    if checked == n:
                        status = 'e'
            else:
                if checked >= x-1:
                    checked = x-1
                    for i in range(x-1, n):
                        d = D[i]
                        if d > 0:
                            status = 's'
                            break
                        elif d < 0:
                            break
                        else:
                            checked += 1
                    if checked == n:
                        status = 'e'
    else:
        df = T[x-1]-y
        if df:
            D[x-1] += df
            T[x-1] = y
            if status == 'e':
                checked = x
                if df > 0:
                    status = 's'
                else:
                    status = 't'
            elif status == 's':
                if checked >= x-1:
                    checked = x-1
                    for i in range(x-1, n):
                        d = D[i]
                        if d > 0:
                            break
                        elif d < 0:
                            status = 't'
                            break
                        else:
                            checked += 1
                    if checked == n:
                        status = 'e'
            else:
                if checked >= x-1:
                    checked = x-1
                    for i in range(x-1, n):
                        d = D[i]
                        if d > 0:
                            status = 's'
                            break
                        elif d < 0:
                            break
                        else:
                            checked += 1
                    if checked == n:
                        status = 'e'
    if status == 's':
        Ans[j] = '>'
    elif status == 'e':
        Ans[j] = '='
    else:
        Ans[j] = '<'
print(*Ans, sep = '\n')
0