結果

問題 No.999 てん vs. ほむ
ユーザー Y17Y17
提出日時 2020-02-28 21:51:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 1,351 ms
コンパイル使用メモリ 158,048 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 18:21:03
合計ジャッジ時間 2,845 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 68 ms
5,376 KB
testcase_10 AC 23 ms
5,376 KB
testcase_11 AC 15 ms
5,376 KB
testcase_12 AC 32 ms
5,376 KB
testcase_13 AC 80 ms
5,376 KB
testcase_14 AC 74 ms
5,376 KB
testcase_15 AC 75 ms
5,376 KB
testcase_16 AC 78 ms
5,376 KB
testcase_17 AC 49 ms
5,376 KB
testcase_18 AC 48 ms
5,376 KB
testcase_19 AC 48 ms
5,376 KB
testcase_20 AC 50 ms
5,376 KB
testcase_21 AC 72 ms
5,376 KB
testcase_22 AC 72 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
	int n;
	cin >> n;
	int arui[100010];
	int brui[100010];

	for(int i = 0;i < n;i++){
		cin >> arui[i+1] >> brui[i+1];
		arui[i+1] += arui[i];
		brui[i+1] += brui[i];
	}

	int ans = LLONG_MIN;
	for(int i = 0;i <= n;i++){
		int hom = arui[i] + brui[n]-brui[i];
		int tem = brui[i] + arui[n]-arui[i]; 
		ans = max(ans, hom-tem);
	}

	cout << ans << endl;

	return 0;
}
0