結果

問題 No.2035 Tunnel
ユーザー ntudantuda
提出日時 2022-08-16 22:22:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 22,996 KB
最終ジャッジ日時 2024-04-14 15:58:37
合計ジャッジ時間 4,417 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,624 KB
testcase_05 AC 137 ms
22,868 KB
testcase_06 AC 140 ms
22,992 KB
testcase_07 AC 135 ms
22,996 KB
testcase_08 AC 87 ms
13,528 KB
testcase_09 AC 133 ms
22,980 KB
testcase_10 AC 138 ms
22,864 KB
testcase_11 AC 121 ms
20,152 KB
testcase_12 AC 136 ms
21,540 KB
testcase_13 AC 41 ms
11,776 KB
testcase_14 AC 58 ms
12,928 KB
testcase_15 AC 114 ms
15,112 KB
testcase_16 AC 101 ms
17,352 KB
testcase_17 AC 32 ms
10,752 KB
testcase_18 AC 37 ms
11,520 KB
testcase_19 AC 62 ms
13,952 KB
testcase_20 AC 119 ms
19,704 KB
testcase_21 AC 71 ms
15,232 KB
testcase_22 AC 70 ms
15,488 KB
testcase_23 AC 45 ms
12,288 KB
testcase_24 AC 86 ms
16,768 KB
testcase_25 AC 100 ms
18,560 KB
testcase_26 AC 94 ms
17,792 KB
testcase_27 AC 131 ms
21,644 KB
testcase_28 AC 74 ms
15,744 KB
testcase_29 AC 46 ms
12,416 KB
testcase_30 AC 42 ms
12,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()

A = [0] * N
i = 0
while S[i] == ".":
    i += 1
S = S[i:]
N = len(S)

for i, s in enumerate(S):
    if s == "#":
        A[i] = A[i - 1] + 1
    else:
        A[i] = A[i - 1] - 1

x = S.index("#")
y = max(A)
print(N - x + y - 1)
0