結果
| 問題 | 
                            No.204 ゴールデン・ウィーク(2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             amylase_pepsin
                         | 
                    
| 提出日時 | 2015-06-13 01:47:30 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 909 bytes | 
| コンパイル時間 | 242 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-10-13 13:21:12 | 
| 合計ジャッジ時間 | 2,984 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 WA * 25 | 
ソースコード
__author__ = 'amylase'
def solve(d, s):
    """
    solution for yukicoder No.204
    >>> solve(2, 'oxxoxxoooooxxo')
    8
    >>> solve(5, 'ooxxxxxooooooo')
    14
    >>> solve(1, 'oxxxxxoxoxxxxo')
    3
    >>> solve(14, 'xxxxxxxxxxxxxx')
    14
    >>> solve(0, 'o' * 14)
    14
    :param d: maximum continuous PTO
    :param s: calendar string
    :return: longest continuous holiday
    """
    n = len(s)
    answer = 0
    for i in range(n):
        j = i
        while j < n and s[j] == 'o' :
            j += 1
        j = min(j + d, n)
        """
        used = 0
        while j < n and s[j] == 'x' and used < d:
            j += 1
            used += 1
        """
        
        while j < n and s[j] == 'o' :
            j += 1
        answer = max(j - i, answer)
    return answer
if __name__ == '__main__':
    d = int(input())
    s = input() + input()
    print(solve(d, s))
            
            
            
        
            
amylase_pepsin