結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-05-07 15:46:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 1,000 ms |
| コード長 | 1,059 bytes |
| コンパイル時間 | 904 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-12-24 11:53:09 |
| 合計ジャッジ時間 | 3,692 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#!/usr/bin/env python3
import array
import copy
import itertools
MAX_D = 14
LEN_C = 14
NUM_DAYS = MAX_D + LEN_C + MAX_D
def compute_max_len_of_holidays(d, is_weekday, paid_start):
assert paid_start < NUM_DAYS
table = copy.copy(is_weekday)
for idx in range(paid_start, NUM_DAYS):
if not table[idx] or d == 0:
break
else:
d -= 1
table[idx] = False
answer = 0
for k, g in itertools.groupby(table):
if not k:
answer = max(answer, len(list(g)))
return answer
def solve(d, is_weekday):
answer = 0
for idx in range(NUM_DAYS):
answer = max(answer, compute_max_len_of_holidays(d, is_weekday, idx))
return answer
def main():
d = int(input())
is_weekday = array.array("B", (True for _ in range(MAX_D)))
is_weekday.extend(map(lambda c: c == "x", input()))
is_weekday.extend(map(lambda c: c == "x", input()))
is_weekday.extend(True for _ in range(MAX_D))
print(solve(d, is_weekday))
if __name__ == '__main__':
main()
はむ吉🐹