結果

問題 No.633 バスの運賃
ユーザー hedwig100
提出日時 2020-05-15 19:59:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 472 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,248 KB
最終ジャッジ日時 2024-09-19 06:26:44
合計ジャッジ時間 5,647 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

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