結果
| 問題 |
No.2629 A replace B replace C
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2024-02-16 21:37:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 384 bytes |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 82,312 KB |
| 実行使用メモリ | 67,808 KB |
| 最終ジャッジ日時 | 2024-09-28 19:51:29 |
| 合計ジャッジ時間 | 4,745 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 61 |
ソースコード
N=int(input())
S=input()
T=input()
firstBC=0
ab=0
bc=0
for i in range(N):
if S[i]=='A' and T[i]=='B':
ab+=1
elif S[i]=='B' and T[i]=='C':
firstBC+=1
bc+=1
elif S[i]=='A' and T[i]=='C':
ab+=1
bc+=1
elif S[i]!=T[i]:
print('No')
exit(0)
if (ab==bc and firstBC>0) or ab==bc==0:
print('Yes')
else:
print('No')
nikoro256