結果
| 問題 |
No.2196 Pair Bonus
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-15 18:59:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 63 ms / 2,000 ms |
| コード長 | 717 bytes |
| コンパイル時間 | 1,776 ms |
| コンパイル使用メモリ | 193,240 KB |
| 最終ジャッジ日時 | 2025-02-10 15:45:13 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) ((int)a.size())
const int maxn=200005;
int n;
ll a[maxn],b[maxn],c[maxn],d[maxn];
signed main(){
ios_base::sync_with_stdio(0),cin.tie(0);
cin >> n;
for(int i=0; i<n*2; ++i) cin >> a[i];
for(int i=0; i<n*2; ++i) cin >> b[i];
for(int i=0; i<n; ++i) cin >> c[i];
for(int i=0; i<n; ++i) cin >> d[i];
ll res=0;
for(int i=0; i<n; ++i){
ll maxx=-1;
for(int j1: {0,1}) for(int j2: {0,1}) maxx=max(maxx,(j1?b[i*2]:a[i*2])+(j2?b[i*2+1]:a[i*2+1])+(j1==j2?c[i]:d[i]));
res+=maxx;
}
cout << res << "\n";
}