結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-08 23:40:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 1,000 ms |
| コード長 | 653 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-12-24 11:39:35 |
| 合計ジャッジ時間 | 2,690 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)