結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-08 23:40:14 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 21 ms / 1,000 ms |
| + 790µs | |
| コード長 | 653 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2026-10-07 06:30:53 |
| 合計ジャッジ時間 | 3,439 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
def longest_holidays(weeks):
longest = 0
x = 0
for day in weeks:
if day == 'o':
x += 1
if x > longest:
longest = x
else:
x = 0
return longest
D = int(input())
first_week = input().rstrip()
second_week = input().rstrip()
golden_weeks = 'x' * 14 + first_week + second_week + 'x' * 14
longest = longest_holidays(golden_weeks)
for d in range(1, D + 1):
for i in range(42 - d + 1):
if golden_weeks[i:i+d] == 'x' * d:
weeks = golden_weeks[:i] + 'o' * d + golden_weeks[i + d:]
longest = max(longest_holidays(weeks), longest)
print(longest)