結果

問題 No.818 Dinner time
ユーザー RyutaroYamauchiRyutaroYamauchi
提出日時 2019-04-25 18:31:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 461 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 55,732 KB
最終ジャッジ日時 2024-05-01 04:46:37
合計ジャッジ時間 15,758 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 487 ms
51,040 KB
testcase_01 AC 491 ms
44,100 KB
testcase_02 AC 487 ms
44,604 KB
testcase_03 AC 491 ms
44,100 KB
testcase_04 AC 485 ms
44,332 KB
testcase_05 AC 493 ms
44,608 KB
testcase_06 AC 488 ms
44,476 KB
testcase_07 AC 496 ms
44,092 KB
testcase_08 AC 494 ms
44,472 KB
testcase_09 AC 497 ms
44,356 KB
testcase_10 AC 485 ms
44,224 KB
testcase_11 AC 495 ms
43,972 KB
testcase_12 AC 492 ms
44,468 KB
testcase_13 AC 499 ms
44,488 KB
testcase_14 AC 494 ms
44,348 KB
testcase_15 AC 495 ms
44,092 KB
testcase_16 AC 489 ms
44,604 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

A = []
B = []

N, M = map(int, input().strip().split(' '))

for i in range(N):
    a, b = map(int, input().strip().split(' '))
    A.append(a)
    B.append(b)

A = np.array(A, dtype=np.int64)
B = np.array(B, dtype=np.int64)

S0 = np.maximum(np.maximum(A * M, A * (M - 1) + B), B)
S1 = np.maximum(A, B)

S = np.cumsum(S0)

for k in range(0, N+1):
    if k < N:
        S[k] += np.cumsum(np.concatenate([[0], S1[k+1:]])).max()

print(S.max())
0