結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-09 00:46:37 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 23 ms / 1,000 ms |
| + 525µs | |
| コード長 | 678 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2026-10-07 06:33:22 |
| 合計ジャッジ時間 | 3,351 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
# coding:utf-8
D = int(input())
C = 'xxxxxxxxxxxxxxx' + input()
C = C + input() + 'xxxxxxxxxxxxxxxxx'
ans = [0]
for i in range(len(C)+1):
for j in range(i, len(C)+1):
e = C[i:j]
# xが連続しているかチェック
flag = 0
for f in range(1, len(e)):
if e[f-1] == 'x' and e[f] == 'o':
flag = 1
if e[f-1] == 'o' and e[f] == 'x' and flag == 1:
break
else:
if D > 0:
if 1 <= e.count('x') <= D:
ans.append(len(e))
if D == 0:
if e.count('x') == 0:
ans.append(len(e))
print(max(ans))