結果

問題 No.909 たぴの配置
ユーザー htensaihtensai
提出日時 2019-11-11 08:31:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 978 ms / 3,000 ms
コード長 775 bytes
コンパイル時間 3,849 ms
コンパイル使用メモリ 73,644 KB
実行使用メモリ 58,960 KB
最終ジャッジ日時 2023-10-13 07:57:01
合計ジャッジ時間 16,926 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
38,928 KB
testcase_01 AC 105 ms
38,872 KB
testcase_02 AC 102 ms
39,048 KB
testcase_03 AC 110 ms
39,168 KB
testcase_04 AC 104 ms
39,004 KB
testcase_05 AC 838 ms
52,732 KB
testcase_06 AC 830 ms
52,308 KB
testcase_07 AC 852 ms
53,336 KB
testcase_08 AC 892 ms
58,628 KB
testcase_09 AC 934 ms
56,284 KB
testcase_10 AC 922 ms
58,960 KB
testcase_11 AC 827 ms
55,244 KB
testcase_12 AC 895 ms
55,368 KB
testcase_13 AC 978 ms
54,016 KB
testcase_14 AC 904 ms
57,452 KB
testcase_15 AC 890 ms
54,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arrX = new int[n];
		int[] arrY = new int[n];
		int[] ans = new int[n];
		for (int i = 0; i < n; i++) {
		    arrX[i] = sc.nextInt();
		}
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
		    arrY[i] = sc.nextInt();
		    min = Math.min(min, arrX[i] + arrY[i]);
		}
		StringBuilder sb = new StringBuilder();
		sb.append(min).append("\n");
		sb.append(0).append("\n");
		for (int i = 0; i < n; i++) {
		    if (min >= arrX[i]) {
		        ans[i] = arrX[i];
		    } else {
		        ans[i] = min;
		    }
		    sb.append(ans[i]).append("\n");
		}
		sb.append(min).append("\n");
		System.out.print(sb);
	}
}
0