結果
| 問題 |
No.818 Dinner time
|
| コンテスト | |
| ユーザー |
tubuann
|
| 提出日時 | 2019-04-20 09:40:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,123 bytes |
| コンパイル時間 | 1,432 ms |
| コンパイル使用メモリ | 133,120 KB |
| 最終ジャッジ日時 | 2025-01-07 02:46:20 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 WA * 2 |
ソースコード
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;
int main(){
ll n,m;
cin>>n>>m;
vector<pll> A(n);
ll ans=-E;
ll sum=0;
ll meat=0;
ll egg=0;
for(auto &I:A){cin>>I.F>>I.S;}
for(auto &I:A){
meat+=max(I.F,I.S);
sum+=max(max(I.F*m-max(I.F,I.S),I.F*(m-1)+I.S-max(I.F,I.S)),I.S-max(I.F,I.S));
if(sum>egg){egg=sum;}
ans=max(ans,egg+meat);
}
cout<<ans<<endl;
return 0;
}
tubuann