結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-16 21:28:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 1,000 ms |
| コード長 | 431 bytes |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-24 11:56:03 |
| 合計ジャッジ時間 | 3,268 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#!/usr/bin/env python3
def takewhile(s, c):
assert c in 'ox'
f = {'o':'x', 'x':'o'}
try:
return s[:s.index(f[c])]
except:
return s
d = int(input())
s = ''
s += input()
s += input()
s = 'x' * d + s + 'x' * d
ans = 0
for i in range(len(s)):
x = len(takewhile(s[i:], 'o'))
y = min(d, len(takewhile(s[i+x:], 'x')))
z = len(takewhile(s[i+x+y:], 'o'))
ans = max(ans, x + y + z)
print(ans)