結果
問題 | No.2629 A replace B replace C |
ユーザー |
![]() |
提出日時 | 2024-02-16 21:41:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 346 bytes |
コンパイル時間 | 146 ms |
コンパイル使用メモリ | 82,420 KB |
実行使用メモリ | 75,728 KB |
最終ジャッジ日時 | 2024-09-28 19:55:49 |
合計ジャッジ時間 | 4,381 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 61 |
ソースコード
n = int(input()) cab = cbc = cac = 0 for c, d in zip(input(), input()): if c > d: print('No') exit() if c == d: continue if c == 'A': if d == 'B': cab += 1 else: cac += 1 else: cbc += 1 ans = cab == cbc and (cac == 0 or cab > 0) print('Yes' if ans else 'No')