結果

問題 No.999 てん vs. ほむ
ユーザー chocono2230chocono2230
提出日時 2020-03-06 12:46:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 776 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 164,216 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-22 03:49:14
合計ジャッジ時間 5,443 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 19 ms
5,376 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define repitr(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n*2);
	rep(snip_i, n*2) cin >> a.at(snip_i);
	
	ll ans = 0;
	rep(i, n+1){
		ll p1 = 0, p2 = 0;
		rep(j, n){
			if(j < i){
				p1 += a.at(j*2); p2 += a.at(j*2+1);
			}else{
				p2 += a.at(j*2); p1 += a.at(j*2+1);
			}
		}
		ll dif = p1 - p2;
		if(i == 0 || ans < dif) ans = dif;
	}
	cout << ans << endl;
	return 0;
}
0