結果
| 問題 |
No.818 Dinner time
|
| コンテスト | |
| ユーザー |
chocopuu
|
| 提出日時 | 2019-04-19 22:41:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 756 bytes |
| コンパイル時間 | 1,514 ms |
| コンパイル使用メモリ | 170,200 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 22:44:09 |
| 合計ジャッジ時間 | 3,459 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 4 WA * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return true;
}
return false;
}
signed main()
{
int N, M;
cin >> N >> M;
vector<int> a(N), b(N);
int last = 0, best = 0, lastmax = 0, bestmax = 0;
for (int i = 0; i < N; i++)
{
cin >> a[i] >> b[i];
last += max(a[i], b[i]);
best += a[i];
chmax(lastmax, last);
chmax(bestmax, best);
}
cout << bestmax * (M - 1) + lastmax << endl;
}
chocopuu