結果
問題 | No.2196 Pair Bonus |
ユーザー | tenten |
提出日時 | 2023-04-21 11:13:01 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 630 ms / 2,000 ms |
コード長 | 2,244 bytes |
コンパイル時間 | 2,813 ms |
コンパイル使用メモリ | 92,480 KB |
実行使用メモリ | 76,264 KB |
最終ジャッジ日時 | 2024-11-06 07:37:51 |
合計ジャッジ時間 | 9,348 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
50,424 KB |
testcase_01 | AC | 53 ms
50,152 KB |
testcase_02 | AC | 54 ms
50,376 KB |
testcase_03 | AC | 630 ms
76,264 KB |
testcase_04 | AC | 538 ms
71,608 KB |
testcase_05 | AC | 84 ms
51,728 KB |
testcase_06 | AC | 73 ms
51,576 KB |
testcase_07 | AC | 81 ms
51,580 KB |
testcase_08 | AC | 236 ms
56,388 KB |
testcase_09 | AC | 512 ms
71,080 KB |
testcase_10 | AC | 348 ms
63,968 KB |
testcase_11 | AC | 274 ms
56,848 KB |
testcase_12 | AC | 431 ms
65,836 KB |
testcase_13 | AC | 99 ms
52,016 KB |
testcase_14 | AC | 181 ms
55,184 KB |
testcase_15 | AC | 104 ms
52,308 KB |
testcase_16 | AC | 405 ms
65,708 KB |
testcase_17 | AC | 104 ms
52,064 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(); long[] reds = new long[n * 2]; for (int i = 0; i < 2 * n; i++) { reds[i] = sc.nextInt(); } long[] blues = new long[n * 2]; for (int i = 0; i < 2 * n; i++) { blues[i] = sc.nextInt(); } long[] sames = new long[n]; for (int i = 0; i < n; i++) { sames[i] = sc.nextInt(); } long[] diffs = new long[n]; for (int i = 0; i < n; i++) { diffs[i] = sc.nextInt(); } long ans = 0; for (int i = 0; i < n; i++) { ans += Math.max(Math.max(reds[i * 2] + reds[i * 2 + 1], blues[i * 2] + blues[i * 2 + 1]) + sames[i], Math.max(reds[i * 2] + blues[i * 2 + 1], blues[i * 2] + reds[i * 2 + 1]) + diffs[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(); } }