結果
| 問題 | No.2629 A replace B replace C |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-02-17 13:36:30 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 394 bytes |
| 記録 | |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 85,272 KB |
| 実行使用メモリ | 81,280 KB |
| 最終ジャッジ日時 | 2026-04-15 11:46:09 |
| 合計ジャッジ時間 | 4,247 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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