結果

問題 No.216 FAC
ユーザー GrenacheGrenache
提出日時 2015-05-26 22:27:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 1,000 ms
コード長 609 bytes
コンパイル時間 2,240 ms
コンパイル使用メモリ 74,436 KB
実行使用メモリ 42,000 KB
最終ジャッジ日時 2024-04-23 01:17:26
合計ジャッジ時間 6,541 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
41,188 KB
testcase_01 AC 123 ms
41,468 KB
testcase_02 AC 128 ms
41,548 KB
testcase_03 AC 136 ms
41,808 KB
testcase_04 AC 130 ms
41,624 KB
testcase_05 AC 129 ms
41,276 KB
testcase_06 AC 121 ms
41,332 KB
testcase_07 AC 129 ms
41,548 KB
testcase_08 AC 130 ms
41,292 KB
testcase_09 AC 111 ms
41,872 KB
testcase_10 AC 130 ms
41,412 KB
testcase_11 AC 133 ms
41,572 KB
testcase_12 AC 128 ms
41,504 KB
testcase_13 AC 120 ms
41,360 KB
testcase_14 AC 109 ms
41,308 KB
testcase_15 AC 128 ms
41,504 KB
testcase_16 AC 138 ms
41,992 KB
testcase_17 AC 139 ms
41,328 KB
testcase_18 AC 134 ms
41,896 KB
testcase_19 AC 151 ms
41,504 KB
testcase_20 AC 136 ms
41,424 KB
testcase_21 AC 149 ms
41,724 KB
testcase_22 AC 137 ms
42,000 KB
testcase_23 AC 152 ms
41,392 KB
testcase_24 AC 152 ms
41,572 KB
testcase_25 AC 136 ms
41,516 KB
testcase_26 AC 119 ms
41,260 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[100];

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		int[] score = new int[100];
		int sco = 0;
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			if (b != 0) {
				score[b - 1] += a[i];
			} else {
				sco += a[i];
			}
		}

		for (int i = 0; i < 100; i++) {
			if (score[i] > sco) {
				System.out.println("NO");
				sc.close();
				return;
			}
		}
		
		System.out.println("YES");
		
		sc.close();
	}
}
0