結果
問題 | No.2196 Pair Bonus |
ユーザー |
![]() |
提出日時 | 2023-02-26 17:14:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 873 bytes |
コンパイル時間 | 440 ms |
コンパイル使用メモリ | 42,028 KB |
実行使用メモリ | 5,504 KB |
最終ジャッジ日時 | 2024-09-14 07:16:54 |
合計ジャッジ時間 | 3,073 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
/* -*- 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; }