結果
問題 | No.818 Dinner time |
ユーザー | shotoyoo |
提出日時 | 2021-07-22 16:04:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 639 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 87,052 KB |
実行使用メモリ | 88,348 KB |
最終ジャッジ日時 | 2023-09-24 14:11:39 |
合計ジャッジ時間 | 7,215 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
71,300 KB |
testcase_01 | AC | 74 ms
71,200 KB |
testcase_02 | AC | 74 ms
71,284 KB |
testcase_03 | AC | 74 ms
71,232 KB |
testcase_04 | AC | 72 ms
71,136 KB |
testcase_05 | AC | 72 ms
71,356 KB |
testcase_06 | AC | 73 ms
71,160 KB |
testcase_07 | AC | 73 ms
71,252 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 71 ms
71,412 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 73 ms
71,360 KB |
testcase_14 | AC | 75 ms
71,172 KB |
testcase_15 | AC | 72 ms
71,304 KB |
testcase_16 | AC | 72 ms
71,252 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 140 ms
83,752 KB |
testcase_23 | AC | 150 ms
85,264 KB |
testcase_24 | AC | 167 ms
88,316 KB |
testcase_25 | AC | 148 ms
84,944 KB |
testcase_26 | WA | - |
testcase_27 | AC | 157 ms
86,052 KB |
testcase_28 | AC | 150 ms
85,408 KB |
testcase_29 | AC | 169 ms
88,188 KB |
testcase_30 | AC | 158 ms
85,876 KB |
testcase_31 | AC | 159 ms
86,104 KB |
testcase_32 | AC | 146 ms
85,732 KB |
ソースコード
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) n,m = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(n)] v0 = [max(a,b) for a,b in ab] v1 = [max(m*a, (m-1)*a+b, b) for a,b in ab] cummax = 0 cum0 = 0 cum1 = 0 ans = -float("inf") for j in range(n): cum0 += v0[j] ans = max(ans, cum0 + cummax) # print(cum0, cummax) cum1 += v1[j] cummax = max(cummax, -cum0 + cum1) ans = max(ans, cum0 + cummax) print(ans)