結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-05 13:55:28 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 1,000 ms |
| コード長 | 403 bytes |
| コンパイル時間 | 65 ms |
| コンパイル使用メモリ | 6,784 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-12-24 11:56:59 |
| 合計ジャッジ時間 | 2,083 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
D = input()
s = raw_input()+raw_input()
o = map(len, filter(None, s.split('x')))
x = map(len, filter(None, s.split('o')))
if len(o) == 0:
print D
exit()
if s.startswith('x'):
x.pop(0)
if s.endswith('x'):
x.pop()
ans = max(o[0]+D, o[-1]+D)
for i in xrange(len(x)):
if x[i] <= D:
ans = max(ans, o[i]+x[i]+o[i+1])
else:
ans = max(ans, max(o[i], o[i+1])+D)
print ans