結果

問題 No.2196 Pair Bonus
ユーザー tnakao0123tnakao0123
提出日時 2023-02-26 17:14:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 873 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 41,448 KB
実行使用メモリ 5,312 KB
最終ジャッジ日時 2023-10-12 08:10:29
合計ジャッジ時間 3,290 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 79 ms
5,312 KB
testcase_04 AC 78 ms
5,308 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 15 ms
4,348 KB
testcase_09 AC 73 ms
5,128 KB
testcase_10 AC 48 ms
4,456 KB
testcase_11 AC 18 ms
4,352 KB
testcase_12 AC 62 ms
4,844 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 8 ms
4,352 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 68 ms
5,188 KB
testcase_17 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2196.cc:  No.2196 Pair Bonus - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_N2 = MAX_N * 2;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N2], bs[MAX_N2], xs[MAX_N], ys[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);
  int n2 = n * 2;
  for (int i = 0; i < n2; i++) scanf("%d", as + i);
  for (int i = 0; i < n2; i++) scanf("%d", bs + i);
  for (int i = 0; i < n; i++) scanf("%d", xs + i);
  for (int i = 0; i < n; i++) scanf("%d", ys + i);

  ll sum = 0;
  for (int i = 0; i < n; i++) {
    int j0 = i * 2, j1 = i * 2 + 1;
    sum += max((ll)xs[i] + max(as[j0] + as[j1], bs[j0] + bs[j1]),
	       (ll)ys[i] + max(as[j0] + bs[j1], bs[j0] + as[j1]));
  }

  printf("%lld\n", sum);
  return 0;
}
0