結果
| 問題 | No.818 Dinner time |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-07-22 17:11:49 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 679 bytes |
| 記録 | |
| コンパイル時間 | 1,029 ms |
| コンパイル使用メモリ | 180,116 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-22 17:11:52 |
| 合計ジャッジ時間 | 3,135 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 20 WA * 9 |
ソースコード
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+5;
const ll inf = -1145141919810;
int n,m;
ll a[N],b[N],maxn = inf,tmp,ans,cnt;
bool ok[N];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
//freopen("remake.in","r",stdin);
//freopen("remake.out","w",stdout);
cin>>n>>m;
ll f[N][2];
for(int i=1;i<=n;i++)
cin>>a[i]>>b[i];
f[0][0] = 0;f[0][1] = inf;
for (int i=1;i<=n;i++){
ll maxn = max({b[i],m*a[i],(m-1)*a[i]+b[i]});
f[i][0] = f[i-1][0]+maxn;
ll take = max(a[i],b[i]);
f[i][1] = max({f[i-1][1],f[i-1][0]+take,f[i-1][1]+take});
ans = max({ans,f[i][0],f[i][1]});
}
cout<<ans;
return 0;
}
vjudge1