結果
問題 | No.2196 Pair Bonus |
ユーザー | tenten |
提出日時 | 2023-01-25 13:53:17 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 589 ms / 2,000 ms |
コード長 | 2,229 bytes |
コンパイル時間 | 4,465 ms |
コンパイル使用メモリ | 86,808 KB |
実行使用メモリ | 71,472 KB |
最終ジャッジ日時 | 2023-09-09 01:40:12 |
合計ジャッジ時間 | 11,432 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
49,552 KB |
testcase_01 | AC | 42 ms
49,588 KB |
testcase_02 | AC | 42 ms
49,444 KB |
testcase_03 | AC | 589 ms
71,472 KB |
testcase_04 | AC | 582 ms
71,400 KB |
testcase_05 | AC | 67 ms
50,880 KB |
testcase_06 | AC | 58 ms
50,468 KB |
testcase_07 | AC | 65 ms
51,476 KB |
testcase_08 | AC | 213 ms
56,248 KB |
testcase_09 | AC | 413 ms
68,844 KB |
testcase_10 | AC | 329 ms
63,168 KB |
testcase_11 | AC | 234 ms
56,564 KB |
testcase_12 | AC | 387 ms
64,724 KB |
testcase_13 | AC | 87 ms
52,160 KB |
testcase_14 | AC | 158 ms
55,176 KB |
testcase_15 | AC | 80 ms
52,176 KB |
testcase_16 | AC | 397 ms
65,520 KB |
testcase_17 | AC | 100 ms
52,224 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int[] aArr = new int[n * 2]; for (int i = 0; i < n * 2; i++) { aArr[i] = sc.nextInt(); } int[] bArr = new int[n * 2]; for (int i = 0; i < n * 2; i++) { bArr[i] = sc.nextInt(); } long[] xArr = new long[n]; for (int i = 0; i < n; i++) { xArr[i] = sc.nextInt(); } long[] yArr = new long[n]; for (int i = 0; i < n; i++) { yArr[i] = sc.nextInt(); } long ans = 0; for (int i = 0; i < n; i++) { ans += Math.max(Math.max(aArr[i * 2] + aArr[i * 2 + 1], bArr[i * 2] + bArr[i * 2 + 1]) + xArr[i], Math.max(aArr[i * 2] + bArr[i * 2 + 1], bArr[i * 2] + aArr[i * 2 + 1]) + yArr[i]); } System.out.println(ans); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }