結果
問題 | No.2018 X-Y-X |
ユーザー |
👑 |
提出日時 | 2022-07-22 21:51:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 363 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 76,416 KB |
最終ジャッジ日時 | 2024-07-04 06:05:42 |
合計ジャッジ時間 | 3,139 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 WA * 24 |
ソースコード
n = int(input())S = input()T = input()if S == T:print(0)exit()if S[0] != T[0] or S[-1] != T[-1]:print(-1)exit()def ok(S):for i in range(1, n - 1):if S[i - 1] == S[i + 1]:return Truereturn Falseif not ok(S) or not ok(T):print(-1)else:print(sum(s != t for s, t in zip(S, T)))