結果

問題 No.343 手抜き工事のプロ
ユーザー mkawa2mkawa2
提出日時 2020-03-02 17:31:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 756 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2024-04-21 22:48:24
合計ジャッジ時間 2,702 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 27 ms
10,624 KB
testcase_05 AC 26 ms
10,496 KB
testcase_06 AC 26 ms
10,496 KB
testcase_07 AC 25 ms
10,624 KB
testcase_08 AC 26 ms
10,624 KB
testcase_09 AC 27 ms
10,624 KB
testcase_10 AC 30 ms
10,496 KB
testcase_11 AC 28 ms
10,496 KB
testcase_12 AC 28 ms
10,624 KB
testcase_13 AC 39 ms
10,880 KB
testcase_14 AC 27 ms
10,752 KB
testcase_15 AC 26 ms
10,624 KB
testcase_16 AC 27 ms
10,624 KB
testcase_17 AC 28 ms
10,624 KB
testcase_18 AC 29 ms
10,624 KB
testcase_19 AC 27 ms
10,496 KB
testcase_20 AC 37 ms
11,136 KB
testcase_21 AC 55 ms
12,160 KB
testcase_22 AC 62 ms
11,520 KB
testcase_23 AC 77 ms
13,696 KB
testcase_24 AC 129 ms
14,592 KB
testcase_25 AC 143 ms
15,488 KB
testcase_26 AC 143 ms
15,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    l=II()
    xx=[0]+[II() for _ in range(n-1)]
    xx.reverse()
    s=0
    ans=n-1
    for i in range(n):
        if i:
            if abs(pre-xx[i])>=l:
                print(-1)
                exit()
            if (2*xx[i]-l)*i<2*s<(2*xx[i]+l)*i and (2*xx[i-1]-l)*i<2*s<(2*xx[i-1]+l)*i:ans-=1
        pre=xx[i]
        s+=xx[i]
    print(ans)

main()
0