結果

問題 No.2629 A replace B replace C
コンテスト
ユーザー tassei903
提出日時 2024-02-11 16:25:18
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 63 ms / 2,000 ms
+ 581µs
コード長 773 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 229 ms
コンパイル使用メモリ 95,948 KB
実行使用メモリ 83,772 KB
最終ジャッジ日時 2026-09-05 17:26:50
合計ジャッジ時間 6,995 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
######################################################################
n = int(input())
s = input()
t = input()

x1, x2, x3 = 0,0,0

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    elif s[i] > t[i]:
        No()
        exit()
    elif s[i] == "A" and t[i] == "B":
        x1 += 1
    elif s[i] == "A" and t[i] == "C":
        x2 += 1
    elif s[i] == "B" and t[i] == "C":
        x3 += 1

if x1 == x2 == x3 == 0:
    Yes()
elif x1 == x3 and x1 > 0:
    Yes()
else:
    No()
0