結果

問題 No.999 てん vs. ほむ
ユーザー Y17
提出日時 2020-02-28 21:51:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 1,366 ms
コンパイル使用メモリ 157,792 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 17:16:40
合計ジャッジ時間 3,433 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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