結果
問題 |
No.2018 X-Y-X
|
ユーザー |
![]() |
提出日時 | 2025-03-26 15:51:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 299 ms |
コンパイル使用メモリ | 82,332 KB |
実行使用メモリ | 95,020 KB |
最終ジャッジ日時 | 2025-03-26 15:52:18 |
合計ジャッジ時間 | 3,705 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 23 |
ソースコード
n = int(input()) s = list(input()) t = list(input()) count = 0 for i in range(n - 2): # Check positions from 1 to N-2 (0-based 0 to N-3) if s[i] == s[i + 2]: if s[i + 1] != t[i + 1]: # Flip the character s[i + 1] = 'A' if s[i + 1] == 'B' else 'B' count += 1 # Check the remaining positions (N-2 to N-1) might need to check again # After processing, check if s equals t if s == t: print(count) else: print(-1)