結果

問題 No.2018 X-Y-X
ユーザー achapiachapi
提出日時 2022-07-22 22:05:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 320 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 96,100 KB
最終ジャッジ日時 2023-09-17 10:11:12
合計ジャッジ時間 5,194 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,284 KB
testcase_01 AC 76 ms
70,984 KB
testcase_02 AC 72 ms
71,364 KB
testcase_03 AC 70 ms
71,052 KB
testcase_04 WA -
testcase_05 AC 71 ms
71,300 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 115 ms
95,208 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 87 ms
77,320 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 86 ms
76,548 KB
testcase_29 AC 84 ms
77,296 KB
testcase_30 AC 92 ms
79,248 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=[*input()]
t=[*input()]
ans=0
for i in range(n-2)[::2]:
    if s[i]==s[i+2]:
        if s[i+1]!=t[i+1]:
            s[i+1]=t[i+1]
            ans+=1
for i in range(1,n-2)[::2]:
    if s[i]==s[i+2]:
        if s[i+1]!=t[i+1]:
            s[i+1]=t[i+1]
            ans+=1
if s==t:print(ans)
else:print(-1)
0