結果

問題 No.216 FAC
ユーザー YOSHIYOSHI
提出日時 2021-03-06 14:00:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 67 ms / 1,000 ms
コード長 789 bytes
コンパイル時間 4,305 ms
コンパイル使用メモリ 80,060 KB
実行使用メモリ 37,836 KB
最終ジャッジ日時 2024-04-17 03:08:31
合計ジャッジ時間 6,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
37,596 KB
testcase_01 AC 57 ms
37,704 KB
testcase_02 AC 53 ms
37,172 KB
testcase_03 AC 57 ms
37,804 KB
testcase_04 AC 57 ms
37,788 KB
testcase_05 AC 56 ms
37,808 KB
testcase_06 AC 56 ms
37,712 KB
testcase_07 AC 56 ms
37,184 KB
testcase_08 AC 57 ms
37,652 KB
testcase_09 AC 67 ms
37,596 KB
testcase_10 AC 56 ms
37,328 KB
testcase_11 AC 56 ms
37,720 KB
testcase_12 AC 58 ms
37,328 KB
testcase_13 AC 58 ms
37,652 KB
testcase_14 AC 57 ms
37,504 KB
testcase_15 AC 59 ms
37,836 KB
testcase_16 AC 54 ms
37,544 KB
testcase_17 AC 59 ms
37,708 KB
testcase_18 AC 57 ms
37,832 KB
testcase_19 AC 57 ms
37,572 KB
testcase_20 AC 55 ms
37,672 KB
testcase_21 AC 55 ms
37,648 KB
testcase_22 AC 57 ms
37,424 KB
testcase_23 AC 59 ms
37,584 KB
testcase_24 AC 59 ms
37,424 KB
testcase_25 AC 58 ms
37,832 KB
testcase_26 AC 59 ms
37,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.Stream;

public class No00000216_Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		int[] a = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int[] b = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int[] other = new int[100];

		int point = 0;
		for(int i = 0; i < n; i++) {
			if(b[i] == 0) {
				point += a[i];
			} else {
				other[b[i] - 1] += a[i];
			}
		}
		Arrays.sort(other);
		System.out.println(point >= other[99] ? "YES" : "NO");
	}
}
0