結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー zombietanzombietan
提出日時 2016-07-27 07:42:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 25 ms / 1,000 ms
コード長 664 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 9,180 KB
最終ジャッジ日時 2023-08-25 23:51:18
合計ジャッジ時間 3,074 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
8,980 KB
testcase_01 AC 22 ms
9,128 KB
testcase_02 AC 22 ms
9,072 KB
testcase_03 AC 21 ms
9,068 KB
testcase_04 AC 20 ms
9,008 KB
testcase_05 AC 25 ms
9,072 KB
testcase_06 AC 21 ms
9,036 KB
testcase_07 AC 21 ms
9,132 KB
testcase_08 AC 21 ms
9,072 KB
testcase_09 AC 22 ms
9,128 KB
testcase_10 AC 23 ms
9,008 KB
testcase_11 AC 22 ms
9,036 KB
testcase_12 AC 23 ms
9,176 KB
testcase_13 AC 21 ms
9,000 KB
testcase_14 AC 22 ms
9,072 KB
testcase_15 AC 21 ms
9,088 KB
testcase_16 AC 21 ms
9,124 KB
testcase_17 AC 22 ms
9,128 KB
testcase_18 AC 22 ms
9,132 KB
testcase_19 AC 21 ms
9,180 KB
testcase_20 AC 21 ms
9,096 KB
testcase_21 AC 22 ms
9,040 KB
testcase_22 AC 22 ms
9,176 KB
testcase_23 AC 22 ms
9,024 KB
testcase_24 AC 22 ms
9,080 KB
testcase_25 AC 22 ms
9,072 KB
testcase_26 AC 21 ms
9,068 KB
testcase_27 AC 21 ms
9,016 KB
testcase_28 AC 21 ms
9,008 KB
testcase_29 AC 21 ms
9,132 KB
testcase_30 AC 21 ms
9,036 KB
testcase_31 AC 22 ms
9,168 KB
testcase_32 AC 21 ms
9,088 KB
testcase_33 AC 22 ms
9,068 KB
testcase_34 AC 23 ms
9,104 KB
testcase_35 AC 21 ms
9,172 KB
testcase_36 AC 21 ms
9,084 KB
testcase_37 AC 21 ms
9,088 KB
testcase_38 AC 22 ms
8,996 KB
testcase_39 AC 21 ms
9,008 KB
testcase_40 AC 20 ms
9,180 KB
testcase_41 AC 22 ms
9,180 KB
testcase_42 AC 22 ms
9,108 KB
testcase_43 AC 21 ms
9,068 KB
testcase_44 AC 21 ms
9,172 KB
testcase_45 AC 22 ms
9,176 KB
testcase_46 AC 21 ms
9,092 KB
testcase_47 AC 22 ms
9,108 KB
testcase_48 AC 21 ms
8,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

def get_max_holidays(weekly):
    holiday = 0
    for m in re.findall('o+', weekly):
        holiday = max(holiday, len(m))
    return holiday

def solve(d, GW):
    ans = 0   
    for i in range(42 - d+1):
        gw = GW[:]
        for j in range(i, i+d):
            if gw[j] == 'x':
                gw[j] = 'o'
            else:
                break
        gw_str = ''.join(gw)
        ans = max(ans, get_max_holidays(gw_str))
    return ans

def main():
    d = int(input())
    w1 = input()
    w2 = input()
    workday = 'xxxxxxx'
    GW = list(workday * 2 + w1 + w2 + workday * 2)
    print(solve(d, GW))

if __name__ == '__main__':
    main()
0