結果
問題 |
No.818 Dinner time
|
ユーザー |
![]() |
提出日時 | 2019-04-28 10:46:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 624 bytes |
コンパイル時間 | 551 ms |
コンパイル使用メモリ | 67,988 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-15 05:54:07 |
合計ジャッジ時間 | 3,611 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 4 WA * 25 |
ソースコード
#include <iostream> #include <algorithm> #include <cstring> #include <sstream> #include <map> #include <queue> #include <vector> #include <climits> using namespace std; typedef long long int ll; typedef pair<ll, ll> pos; const ll MOD = 1000000007,N=100010; ll n, m, fn = INT_MIN,fn2=INT_MIN; pos ab[N]; int main() { cin >> n >> m; for (ll i = 1,cfn=0; i <= n; i++) { cin >> ab[i].first >> ab[i].second; cfn += max(ab[i].first, ab[i].second); fn = max(cfn, fn); } for (ll i = 1, cfn2 = 0; i <= n; i++) { cfn2 += ab[i].first; fn2 = max(cfn2, fn2); } cout << fn + max((ll)0,fn2) * (m - 1) << endl; return 0; }