結果

問題 No.2196 Pair Bonus
ユーザー 👑 chro_96chro_96
提出日時 2023-01-20 21:56:14
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 887 bytes
コンパイル時間 1,085 ms
コンパイル使用メモリ 28,496 KB
実行使用メモリ 6,616 KB
最終ジャッジ日時 2023-09-05 14:13:04
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,512 KB
testcase_01 AC 3 ms
6,468 KB
testcase_02 AC 3 ms
6,496 KB
testcase_03 AC 81 ms
6,600 KB
testcase_04 AC 81 ms
6,512 KB
testcase_05 AC 3 ms
6,528 KB
testcase_06 AC 3 ms
6,516 KB
testcase_07 AC 4 ms
6,616 KB
testcase_08 AC 15 ms
6,420 KB
testcase_09 AC 77 ms
6,556 KB
testcase_10 AC 51 ms
6,456 KB
testcase_11 AC 20 ms
6,604 KB
testcase_12 AC 64 ms
6,476 KB
testcase_13 AC 3 ms
6,492 KB
testcase_14 AC 9 ms
6,608 KB
testcase_15 AC 4 ms
6,556 KB
testcase_16 AC 72 ms
6,540 KB
testcase_17 AC 5 ms
6,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int n = 0;
  long long ab[200000][2] = {};
  long long x[100000] = {};
  long long y[100000] = {};
  
  int res = 0;
  
  long long ans = 0LL;
  
  res = scanf("%d", &n);
  for (int i = 0; i < 2*n; i++) {
    res = scanf("%lld", ab[i]);
  }
  for (int i = 0; i < 2*n; i++) {
    res = scanf("%lld", ab[i]+1);
  }
  for (int i = 0; i < n; i++) {
    res = scanf("%lld", x+i);
  }
  for (int i = 0; i < n; i++) {
    res = scanf("%lld", y+i);
  }
  
  for (int i = 0; i < n; i++) {
    long long max = 0LL;
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        long long tmp = ab[2*i][j]+ab[2*i+1][k];
        if (j == k) {
          tmp += x[i];
        } else {
          tmp += y[i];
        }
        if (tmp > max) {
          max = tmp;
        }
      }
    }
    ans += max;
  }
  
  printf("%lld\n", ans);
  return 0;
}
0