結果

問題 No.633 バスの運賃
ユーザー hedwig100hedwig100
提出日時 2020-05-15 19:59:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 503 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 11,868 KB
実行使用メモリ 42,464 KB
最終ジャッジ日時 2023-10-19 10:16:11
合計ジャッジ時間 6,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 496 ms
42,464 KB
testcase_01 AC 493 ms
42,464 KB
testcase_02 AC 484 ms
42,464 KB
testcase_03 AC 489 ms
42,464 KB
testcase_04 AC 483 ms
42,464 KB
testcase_05 AC 490 ms
42,464 KB
testcase_06 AC 494 ms
42,464 KB
testcase_07 AC 503 ms
42,464 KB
testcase_08 AC 496 ms
42,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
import numpy as np

def main():  
    N = int(input())
    A = np.array([input() for _ in range(N - 1)],np.int32)
    count = np.zeros(N,np.int32)
    bus = np.array([input().split() for _ in range(N)],np.int32)
    count -= bus[:,0]
    count += bus[:,1]
    count = np.cumsum(count)
    ans = np.dot(count[:-1],A)
    print(ans)
if __name__ == '__main__':
    main()
0