結果
| 問題 | No.2018 X-Y-X |
| コンテスト | |
| ユーザー |
siganai
|
| 提出日時 | 2022-07-22 22:44:20 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 746 bytes |
| 記録 | |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 95,984 KB |
| 実行使用メモリ | 94,080 KB |
| 最終ジャッジ日時 | 2026-08-06 04:16:39 |
| 合計ジャッジ時間 | 5,763 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 TLE * 1 -- * 24 |
ソースコード
#!/usr/bin/env PyPy3
from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools
mod=998244353
import sys
input=sys.stdin.readline
n = int(input())
s = list(input().rstrip())
t = list(input().rstrip())
if s[0] != t[0] or s[-1] != t[-1]:
print(-1)
exit()
ans = 0
for i in range(1,n):
if s[i] != t[i]:
j = i + 1
while j < n and s[j-2] != s[j]:
j += 1
if j == n:
print(-1)
exit()
for k in range(j-1,i-1,-1):
if s[k] == 'A':
s[k] = 'B'
else:
s[k] = 'A'
ans += 1
print(ans)
siganai