結果

問題 No.1199 お菓子配り-2
ユーザー 57tggx57tggx
提出日時 2020-08-22 08:30:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 441 ms / 1,000 ms
コード長 537 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 66,416 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 14:05:52
合計ジャッジ時間 16,285 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 110 ms
5,376 KB
testcase_04 AC 277 ms
5,376 KB
testcase_05 AC 9 ms
5,376 KB
testcase_06 AC 16 ms
5,376 KB
testcase_07 AC 133 ms
5,376 KB
testcase_08 AC 183 ms
5,376 KB
testcase_09 AC 111 ms
5,376 KB
testcase_10 AC 28 ms
5,376 KB
testcase_11 AC 86 ms
5,376 KB
testcase_12 AC 84 ms
5,376 KB
testcase_13 AC 29 ms
5,376 KB
testcase_14 AC 25 ms
5,376 KB
testcase_15 AC 21 ms
5,376 KB
testcase_16 AC 178 ms
5,376 KB
testcase_17 AC 85 ms
5,376 KB
testcase_18 AC 184 ms
5,376 KB
testcase_19 AC 50 ms
5,376 KB
testcase_20 AC 334 ms
5,376 KB
testcase_21 AC 203 ms
5,376 KB
testcase_22 AC 106 ms
5,376 KB
testcase_23 AC 148 ms
5,376 KB
testcase_24 AC 204 ms
5,376 KB
testcase_25 AC 32 ms
5,376 KB
testcase_26 AC 233 ms
5,376 KB
testcase_27 AC 187 ms
5,376 KB
testcase_28 AC 436 ms
5,376 KB
testcase_29 AC 438 ms
5,376 KB
testcase_30 AC 436 ms
5,376 KB
testcase_31 AC 441 ms
5,376 KB
testcase_32 AC 438 ms
5,376 KB
testcase_33 AC 437 ms
5,376 KB
testcase_34 AC 438 ms
5,376 KB
testcase_35 AC 437 ms
5,376 KB
testcase_36 AC 435 ms
5,376 KB
testcase_37 AC 436 ms
5,376 KB
testcase_38 AC 436 ms
5,376 KB
testcase_39 AC 438 ms
5,376 KB
testcase_40 AC 435 ms
5,376 KB
testcase_41 AC 435 ms
5,376 KB
testcase_42 AC 439 ms
5,376 KB
testcase_43 AC 437 ms
5,376 KB
testcase_44 AC 435 ms
5,376 KB
testcase_45 AC 435 ms
5,376 KB
testcase_46 AC 436 ms
5,376 KB
testcase_47 AC 436 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cassert>

using ll = long long;

void chmax(ll &x, const ll &y){
	if(x < y) x = y;
}

int main(){
	int n, m;
	std::cin >> n >> m;
	assert(1 <= n && n <= 1000);
	assert(1 <= m && m <= 1000);
	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;
			assert(1ll <= tmp && tmp <= 10000000000ll);
			a += tmp;
		}
		chmax(plus, minus + a);
		chmax(minus, plus - a);
	}
	std::cout << std::max(plus, minus) << std::endl;
}

0