結果

問題 No.216 FAC
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-14 17:01:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 159 ms / 1,000 ms
コード長 664 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 74,540 KB
実行使用メモリ 41,824 KB
最終ジャッジ日時 2024-04-28 19:34:22
合計ジャッジ時間 6,918 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,360 KB
testcase_01 AC 134 ms
41,400 KB
testcase_02 AC 131 ms
41,520 KB
testcase_03 AC 144 ms
41,224 KB
testcase_04 AC 140 ms
41,340 KB
testcase_05 AC 138 ms
41,392 KB
testcase_06 AC 135 ms
41,432 KB
testcase_07 AC 132 ms
41,560 KB
testcase_08 AC 133 ms
41,668 KB
testcase_09 AC 119 ms
40,024 KB
testcase_10 AC 133 ms
41,172 KB
testcase_11 AC 134 ms
41,420 KB
testcase_12 AC 135 ms
41,472 KB
testcase_13 AC 138 ms
41,512 KB
testcase_14 AC 134 ms
41,264 KB
testcase_15 AC 134 ms
41,280 KB
testcase_16 AC 147 ms
41,552 KB
testcase_17 AC 154 ms
41,464 KB
testcase_18 AC 150 ms
41,628 KB
testcase_19 AC 149 ms
41,612 KB
testcase_20 AC 159 ms
41,228 KB
testcase_21 AC 145 ms
41,696 KB
testcase_22 AC 157 ms
41,656 KB
testcase_23 AC 146 ms
41,824 KB
testcase_24 AC 144 ms
41,800 KB
testcase_25 AC 149 ms
41,716 KB
testcase_26 AC 132 ms
41,008 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();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		for(int i = 0 ; i < n ; i++) b[i] = sc.nextInt();
		int[] point = new int[100];
		int max = -1001001001; int ret = 0;
		for(int i = 0 ; i < n ; i++) {
			if(b[i] != 0) {
				point[b[i] - 1] += a[i];
			} else {
				ret += a[i];
			}
		}
		for(int i = 0 ; i < 100 ; i++) {
			max = Math.max(max, point[i]);
		}
		if(ret >= max) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
 	}
}
0