結果
| 問題 |
No.2629 A replace B replace C
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-02-17 13:36:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 394 bytes |
| コンパイル時間 | 426 ms |
| コンパイル使用メモリ | 82,436 KB |
| 実行使用メモリ | 76,568 KB |
| 最終ジャッジ日時 | 2024-09-28 23:41:02 |
| 合計ジャッジ時間 | 5,788 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 61 |
ソースコード
N = int(input())
S = input()
T = input()
if S == T:
print("Yes")
exit()
from collections import defaultdict
dic = defaultdict(int)
for i in range(N):
if S[i] > T[i]:
print("No")
exit()
elif S[i] < T[i]:
dic[(S[i],T[i])] += 1
if dic[('A','B')] == 0:
print("No")
exit()
if dic[('A','B')] != dic[('B','C')]:
print("No")
exit()
print("Yes")
ntuda