結果
| 問題 | No.818 Dinner time |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-07-22 17:49:37 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,021 bytes |
| 記録 | |
| コンパイル時間 | 889 ms |
| コンパイル使用メモリ | 180,764 KB |
| 実行使用メモリ | 6,016 KB |
| 最終ジャッジ日時 | 2026-07-22 17:49:40 |
| 合計ジャッジ時間 | 3,316 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 1 WA * 28 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define us unsigned
#define ll long long
#define db double
#define ldb long double
#define pb push_back
#define rs resize
#define il inline
#define For(i,a,b) for(ll i=(a);i<=(b);++i)
#define Rep(i,a,b) for(ll i=(a);i>=(b);--i)
//#define getchar getchar_unlocked
inline ll read(){
ll num=0,f=1;char c=getchar();
while(c>'9' || c<'0'){if(c=='-')f=-1;c=getchar();}
while(c>='0' && c<='9')num=(num<<3)+(num<<1)+(c^48),c=getchar();
return num*f;
}
inline void write(ll x){
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10^48);
}
const ll N=1e5+5;
ll n,m,a[N],b[N],ans=-1e18,f[N];
int main(){
//ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//freopen("remake.in","r",stdin);
//freopen("remake.out","w",stdout);
n=read(),m=read();
For(i,1,n){
a[i]=read(),b[i]=read();
}
For(i,1,n){
ll res=b[i],
res1=a[i]*m,
res2=a[i]*(m-1)+b[i],
res3=a[i];
f[i]=f[i-1]+max({res,res1,res2,res3});
ans=max(ans,f[i]);
}
write(ans);
return 0;
}
//114514
vjudge1