結果

問題 No.2196 Pair Bonus
ユーザー i_am_noobi_am_noob
提出日時 2023-02-15 18:59:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 717 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 198,940 KB
実行使用メモリ 9,000 KB
最終ジャッジ日時 2023-09-25 03:20:20
合計ジャッジ時間 5,620 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,532 KB
testcase_01 AC 2 ms
7,472 KB
testcase_02 AC 2 ms
7,472 KB
testcase_03 AC 74 ms
9,000 KB
testcase_04 AC 75 ms
8,832 KB
testcase_05 AC 3 ms
7,484 KB
testcase_06 AC 3 ms
7,468 KB
testcase_07 AC 3 ms
7,796 KB
testcase_08 AC 14 ms
7,724 KB
testcase_09 AC 68 ms
8,688 KB
testcase_10 AC 46 ms
8,404 KB
testcase_11 AC 18 ms
8,072 KB
testcase_12 AC 59 ms
8,556 KB
testcase_13 AC 3 ms
7,704 KB
testcase_14 AC 8 ms
7,604 KB
testcase_15 AC 3 ms
7,492 KB
testcase_16 AC 62 ms
8,752 KB
testcase_17 AC 4 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
}
0