結果
| 問題 |
No.1199 お菓子配り-2
|
| コンテスト | |
| ユーザー |
57tggx
|
| 提出日時 | 2020-07-20 18:32:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 538 bytes |
| コンパイル時間 | 696 ms |
| コンパイル使用メモリ | 70,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-14 02:21:04 |
| 合計ジャッジ時間 | 19,229 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 45 |
ソースコード
#include <iostream>
#include <vector>
using ll = long long;
ll chmax(ll &x, const ll &y){
if(x < y) x = y;
return x;
}
int main(){
int n, m;
std::cin >> n >> m;
std::vector<ll> a(n, 0);
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j){
ll tmp;
std::cin >> tmp;
a[i] += tmp;
}
}
std::vector<ll> plus(n + 1, 0), minus(n + 1, 0);
ll ans = 0;
for(int i = 0; i < n; ++i){
chmax(ans, chmax(plus[i + 1], minus[i] + a[i]));
chmax(ans, chmax(minus[i + 1], plus[i] - a[i]));
}
std::cout << ans << std::endl;
}
57tggx