結果

問題 No.2196 Pair Bonus
ユーザー mushilymushily
提出日時 2023-03-16 10:31:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 835 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 64,400 KB
実行使用メモリ 8,304 KB
最終ジャッジ日時 2023-10-18 12:56:24
合計ジャッジ時間 3,027 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,676 KB
testcase_01 AC 2 ms
5,676 KB
testcase_02 AC 2 ms
5,676 KB
testcase_03 AC 243 ms
8,304 KB
testcase_04 AC 243 ms
8,304 KB
testcase_05 AC 3 ms
5,692 KB
testcase_06 AC 3 ms
5,684 KB
testcase_07 AC 3 ms
5,692 KB
testcase_08 AC 41 ms
6,060 KB
testcase_09 AC 225 ms
8,112 KB
testcase_10 AC 146 ms
7,088 KB
testcase_11 AC 54 ms
6,176 KB
testcase_12 AC 190 ms
7,656 KB
testcase_13 AC 3 ms
5,688 KB
testcase_14 AC 22 ms
5,884 KB
testcase_15 AC 4 ms
5,696 KB
testcase_16 AC 196 ms
8,112 KB
testcase_17 AC 6 ms
5,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
int main()
{
    long long s = 0, t1, t2;
    long a[200000];
    long b[200000];
    long x[100000];
    long y[100000];
    int n, i, q, h;

    cin >> n;
    for (i = 0; i < (n << 1); i++)
    {
        cin >> a[i];
    }
    for (i = 0; i < (n << 1); i++)
    {
        cin >> b[i];
    }
    for (i = 0; i < n; i++)
    {
        cin >> x[i];
    }
    for (i = 0; i < n; i++)
    {
        cin >> y[i];
    }
    for (i = 0; i < n; i++)
    {
        q = i << 1;
        h = q + 1;
        t1 = a[q] + a[h] + x[i];
        t2 = a[q] + b[h] + y[i];
        if (t1 < t2)
            t1 = t2;
        t2 = b[q] + a[h] + y[i];
        if (t1 < t2)
            t1 = t2;
        t2 = b[q] + b[h] + x[i];
        if (t1 < t2)
            t1 = t2;
        s += t1;
    }
    cout << s << endl;
}
0