結果

問題 No.2035 Tunnel
ユーザー first_vilfirst_vil
提出日時 2022-08-12 21:32:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 97,584 KB
最終ジャッジ日時 2023-10-24 08:25:45
合計ジャッジ時間 4,570 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,444 KB
testcase_01 AC 40 ms
53,444 KB
testcase_02 AC 40 ms
53,444 KB
testcase_03 AC 39 ms
53,444 KB
testcase_04 AC 39 ms
53,444 KB
testcase_05 AC 191 ms
92,832 KB
testcase_06 AC 192 ms
92,832 KB
testcase_07 AC 190 ms
92,832 KB
testcase_08 AC 45 ms
59,920 KB
testcase_09 AC 45 ms
59,920 KB
testcase_10 AC 218 ms
97,584 KB
testcase_11 AC 135 ms
83,428 KB
testcase_12 AC 151 ms
84,620 KB
testcase_13 AC 75 ms
75,368 KB
testcase_14 AC 90 ms
77,036 KB
testcase_15 AC 141 ms
83,464 KB
testcase_16 AC 119 ms
81,224 KB
testcase_17 AC 59 ms
70,164 KB
testcase_18 AC 72 ms
75,320 KB
testcase_19 AC 93 ms
77,760 KB
testcase_20 AC 133 ms
83,436 KB
testcase_21 AC 105 ms
80,332 KB
testcase_22 AC 107 ms
80,332 KB
testcase_23 AC 75 ms
76,568 KB
testcase_24 AC 123 ms
83,260 KB
testcase_25 AC 142 ms
85,720 KB
testcase_26 AC 136 ms
84,372 KB
testcase_27 AC 178 ms
90,632 KB
testcase_28 AC 109 ms
81,124 KB
testcase_29 AC 77 ms
76,868 KB
testcase_30 AC 72 ms
76,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
mod = int(1e9 + 7)
# mod = 998244353

n = ii()
s = input()
a = [i for i in range(n)[::-1] if s[i] == "#"]


ng = 0
ok = int(1e18)
while ok - ng > 1:
    mid = ok + ng >> 1
    mn = INF
    pre = INF
    for x in a:
        mn = min(mn, x + mid, pre - 2)
        pre = min(x + mid, pre - 2)
    if mn >= n:
        ok = mid
    else:
        ng = mid
print(ok)
0