結果
問題 | No.2018 X-Y-X |
ユーザー | achapi |
提出日時 | 2022-07-22 22:08:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 651 bytes |
コンパイル時間 | 273 ms |
コンパイル使用メモリ | 87,316 KB |
実行使用メモリ | 99,408 KB |
最終ジャッジ日時 | 2023-09-17 10:17:14 |
合計ジャッジ時間 | 5,325 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,168 KB |
testcase_01 | AC | 72 ms
71,348 KB |
testcase_02 | AC | 74 ms
71,224 KB |
testcase_03 | AC | 74 ms
71,328 KB |
testcase_04 | WA | - |
testcase_05 | AC | 74 ms
71,224 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 | 133 ms
99,136 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 96 ms
78,944 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 93 ms
77,344 KB |
testcase_29 | AC | 95 ms
82,284 KB |
testcase_30 | AC | 120 ms
89,996 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
ソースコード
n=int(input()) s=[*input()] t=[*input()] S=s[:] T=t[:] a=[] 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:a.append(ans) ans=0 s=S[:] t=T[:] 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 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 if s==t:a.append(ans) if len(a)==0:print(-1) else:print(min(a))