結果

問題 No.2196 Pair Bonus
ユーザー ShirotsumeShirotsume
提出日時 2022-02-06 21:54:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,193 ms / 2,000 ms
コード長 1,038 bytes
コンパイル時間 4,477 ms
コンパイル使用メモリ 73,560 KB
実行使用メモリ 69,016 KB
最終ジャッジ日時 2023-09-02 07:17:02
合計ジャッジ時間 13,983 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,716 KB
testcase_01 AC 124 ms
55,724 KB
testcase_02 AC 131 ms
55,768 KB
testcase_03 AC 1,193 ms
68,816 KB
testcase_04 AC 1,178 ms
68,836 KB
testcase_05 AC 207 ms
57,112 KB
testcase_06 AC 199 ms
58,876 KB
testcase_07 AC 204 ms
59,512 KB
testcase_08 AC 558 ms
60,516 KB
testcase_09 AC 1,134 ms
69,000 KB
testcase_10 AC 1,010 ms
66,680 KB
testcase_11 AC 624 ms
60,244 KB
testcase_12 AC 1,068 ms
68,664 KB
testcase_13 AC 211 ms
58,636 KB
testcase_14 AC 449 ms
60,596 KB
testcase_15 AC 210 ms
58,928 KB
testcase_16 AC 1,098 ms
69,016 KB
testcase_17 AC 254 ms
57,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	  public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
	        long [] a = new long [2 * n + 1];
	        long [] b = new long [2 * n + 1];
	        long [] x = new long [n + 1];
	        long [] y = new long [n + 1];
	        for(int i = 0; i < 2 * n; i++){
	        	a[i] = sc.nextLong();
	        }
	        for(int i = 0; i < 2 * n; i++){
	        	b[i] = sc.nextLong();
	        }
	        for(int i = 0; i < n; i++){
	        	x[i] = sc.nextLong();
	        }
	        for(int i = 0; i < n; i++){
	        	y[i] = sc.nextLong();
	        }
	        long ans = 0;
	        for(int i = 0; i < n; i++){
	        	long tmp = 0;
	        	tmp = Math.max(a[2 * i] + a[2 * i + 1] + x[i], a[2 * i] + b[2 * i + 1] + y[i]);
	        	tmp = Math.max(tmp,  b[2 * i] + a[2 * i + 1] + y[i]);
	        	tmp = Math.max(tmp,  b[2 * i] + b[2 * i + 1] + x[i]);
	        	ans += tmp;
	        }
	        System.out.println(ans);
	    }


}
0