結果

問題 No.2035 Tunnel
ユーザー ygd.ygd.
提出日時 2022-08-12 21:41:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 893 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 10,836 KB
最終ジャッジ日時 2023-10-24 08:58:15
合計ジャッジ時間 3,471 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,152 KB
testcase_01 AC 28 ms
10,152 KB
testcase_02 AC 28 ms
10,152 KB
testcase_03 AC 28 ms
10,152 KB
testcase_04 AC 28 ms
10,152 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 86 ms
10,520 KB
testcase_09 AC 52 ms
10,520 KB
testcase_10 AC 119 ms
10,520 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
#import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
#from collections import defaultdict 
#from collections import deque
#import copy
#import math
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    N = int(input())
    S = str(input())

    ans = N
    idx = 0
    while idx < N and S[idx] == '.':
        idx += 1
    ans -= idx

    seq = 0
    temp = 0
    for i in range(N):
        if S[i] == '#':
            temp += 1
            seq = max(seq, temp)
        else:
            temp = 0
    
    ans += seq - 1
    print(ans)



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