結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-05-07 15:46:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 22 ms / 1,000 ms
コード長 1,059 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 8,912 KB
最終ジャッジ日時 2023-08-25 23:49:26
合計ジャッジ時間 3,061 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
8,844 KB
testcase_01 AC 21 ms
8,704 KB
testcase_02 AC 21 ms
8,912 KB
testcase_03 AC 22 ms
8,712 KB
testcase_04 AC 21 ms
8,852 KB
testcase_05 AC 21 ms
8,732 KB
testcase_06 AC 21 ms
8,732 KB
testcase_07 AC 22 ms
8,904 KB
testcase_08 AC 22 ms
8,728 KB
testcase_09 AC 21 ms
8,912 KB
testcase_10 AC 22 ms
8,740 KB
testcase_11 AC 21 ms
8,716 KB
testcase_12 AC 21 ms
8,732 KB
testcase_13 AC 22 ms
8,728 KB
testcase_14 AC 22 ms
8,896 KB
testcase_15 AC 21 ms
8,776 KB
testcase_16 AC 22 ms
8,888 KB
testcase_17 AC 22 ms
8,900 KB
testcase_18 AC 21 ms
8,716 KB
testcase_19 AC 21 ms
8,896 KB
testcase_20 AC 22 ms
8,712 KB
testcase_21 AC 21 ms
8,780 KB
testcase_22 AC 21 ms
8,888 KB
testcase_23 AC 22 ms
8,716 KB
testcase_24 AC 22 ms
8,720 KB
testcase_25 AC 21 ms
8,744 KB
testcase_26 AC 21 ms
8,844 KB
testcase_27 AC 21 ms
8,712 KB
testcase_28 AC 21 ms
8,768 KB
testcase_29 AC 21 ms
8,708 KB
testcase_30 AC 21 ms
8,912 KB
testcase_31 AC 22 ms
8,904 KB
testcase_32 AC 21 ms
8,728 KB
testcase_33 AC 21 ms
8,716 KB
testcase_34 AC 21 ms
8,888 KB
testcase_35 AC 21 ms
8,884 KB
testcase_36 AC 22 ms
8,732 KB
testcase_37 AC 21 ms
8,892 KB
testcase_38 AC 21 ms
8,888 KB
testcase_39 AC 21 ms
8,884 KB
testcase_40 AC 21 ms
8,848 KB
testcase_41 AC 21 ms
8,848 KB
testcase_42 AC 21 ms
8,884 KB
testcase_43 AC 21 ms
8,892 KB
testcase_44 AC 22 ms
8,892 KB
testcase_45 AC 21 ms
8,776 KB
testcase_46 AC 22 ms
8,728 KB
testcase_47 AC 21 ms
8,708 KB
testcase_48 AC 22 ms
8,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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()
0