結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-01-20 08:22:27 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 24 ms / 1,000 ms |
| + 731µs | |
| コード長 | 486 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 82,072 KB |
| 実行使用メモリ | 56,260 KB |
| 最終ジャッジ日時 | 2026-09-28 15:57:10 |
| 合計ジャッジ時間 | 3,197 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
d = int(input())
C = "o" + "x" * (d + 1) + input() + input() + "x" * (d + 1) + "o"
if C.count("o") == 2:
print(d)
exit()
bef = "o"
lst = []
cnt = 0
for c in C:
if c != bef:
lst.append(cnt)
cnt = 1
bef = c
else:
cnt += 1
lst.append(cnt)
l = len(lst)
ans = 0
for i in range(1, l, 2):
if lst[i] <= d:
ans = max(ans, lst[i - 1] + lst[i] + lst[i + 1])
else:
ans = max(ans, max(lst[i - 1], lst[i + 1]) + d)
print(ans)