結果
| 問題 |
No.818 Dinner time
|
| コンテスト | |
| ユーザー |
👑 SPD_9X2
|
| 提出日時 | 2025-10-26 16:55:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 829 bytes |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 82,080 KB |
| 実行使用メモリ | 77,176 KB |
| 最終ジャッジ日時 | 2025-10-26 16:56:02 |
| 合計ジャッジ時間 | 5,173 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 8 |
ソースコード
"""
https://yukicoder.me/problems/no/818
2~K-1日目までは同じだろう
1 2 Last
A A A 0<B<A
A A B 0<A<B
B - - A<0 のものは使用するならこれ?
- - B 存在する? -> メリット無さそう
- - -
"""
N,M = map(int,input().split())
now = [0,0]
ans = 0
ed = 1
fi = 0 if M==1 else 1
mid = M - ed - fi
for i in range(N):
A,B = map(int,input().split())
n2 = [0,0]
if 0 <= A <= B:
n2[0] = max(n2[0], now[0] + fi * A + mid * A + ed * B)
n2[1] = max(n2[1], max(now) + B)
elif B <= A and 0 <= A:
n2[0] = max(n2[0], now[0] + A * M)
n2[1] = max(n2[1], max(now) + A)
else:
n2[0] = max(n2[0], now[0] + max(A*M,B))
n2[1] = max(n2[1], max(now) + max(A,B))
# print (n2)
now = n2
ans = max(ans, max(now))
print (ans)
SPD_9X2