結果

問題 No.1199 お菓子配り-2
ユーザー 57tggx
提出日時 2020-07-20 18:59:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 432 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 66,264 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-14 02:22:11
合計ジャッジ時間 15,745 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
	ll plus = 0, minus = 0;
	for(int i = 0; i < n; ++i){
		ll a = 0;
		for(int j = 0; j < m; ++j){
			ll tmp;
			std::cin >> tmp;
			a += tmp;
		}
		chmax(plus, minus + a);
		chmax(minus, plus - a);
	}
	std::cout << std::max(plus, minus) % 1000000007 << std::endl;
}
0