結果

問題 No.2196 Pair Bonus
ユーザー 👑 potato167potato167
提出日時 2023-01-21 02:24:43
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 1,964 ms
コンパイル使用メモリ 199,900 KB
実行使用メモリ 7,828 KB
最終ジャッジ日時 2023-09-05 18:25:36
合計ジャッジ時間 4,449 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 229 ms
7,752 KB
testcase_04 AC 228 ms
7,828 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 39 ms
4,376 KB
testcase_09 AC 212 ms
7,540 KB
testcase_10 AC 137 ms
5,960 KB
testcase_11 AC 50 ms
4,376 KB
testcase_12 AC 180 ms
6,836 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 20 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 186 ms
7,804 KB
testcase_17 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
using ll = long long;
#define all(p) p.begin(),p.end()

int main(){
	ll N;
	cin>>N;
	ll ans=0;
	vector<ll> A(2*N),B(2*N),X(N),Y(N);
	rep(i,0,N*2) cin>>A[i];
	rep(i,0,N*2) cin>>B[i];
	rep(i,0,N) cin>>X[i];
	rep(i,0,N) cin>>Y[i];
	rep(i,0,N){
		ll v=0;
		rep(k,0,4){
			ll tmp=0;
			if(k<2) tmp+=A[i*2];
			else tmp+=B[i*2];
			if(k&1) tmp+=A[i*2+1];
			else tmp+=B[i*2+1];
			if(k==1||k==2) tmp+=X[i];
			else tmp+=Y[i];
			v=max(tmp,v);
		}
		ans+=v;
	}
	cout<<ans<<"\n";
}
0