結果
問題 | No.1439 Let's Compare!!!! |
ユーザー |
|
提出日時 | 2022-10-14 17:21:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,720 bytes |
コンパイル時間 | 316 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 28,228 KB |
最終ジャッジ日時 | 2024-06-26 12:41:23 |
合計ジャッジ時間 | 4,457 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 8 TLE * 1 -- * 8 |
ソースコード
def judge_which_larger( compare: list[str], init_digit: int = 1) -> tuple[str, int]: for digit, mark in enumerate(compare[init_digit-1:], init_digit): if mark == "=": continue return mark, digit return "=", digit def main(): _ = input() S = list(map(int, str(input()))) T = list(map(int, str(input()))) S_T_compare = [] for s_num, t_num in zip(S, T): if s_num > t_num: S_T_compare.append(">") elif s_num == t_num: S_T_compare.append("=") else: S_T_compare.append("<") current_status, diff_digit = judge_which_larger(S_T_compare) print(diff_digit) for _ in range(int(input())): which_num, digit, number = input().split() digit = int(digit) number = int(number) if which_num == "S": S[digit-1] = number elif which_num == "T": T[digit-1] = number else: raise ValueError if S[digit-1] > T[digit-1]: S_T_compare[digit-1] = ">" elif S[digit-1] == T[digit-1]: S_T_compare[digit-1] = "=" else: S_T_compare[digit-1] = "<" if diff_digit < digit: print(current_status) elif diff_digit > digit: if S_T_compare[digit-1] == "=": print(current_status) else: print(S_T_compare[digit-1]) current_status = S_T_compare[digit-1] diff_digit = digit else: current_status, diff_digit = judge_which_larger( S_T_compare, diff_digit) print(current_status) if __name__ == "__main__": main()