結果

問題 No.216 FAC
ユーザー shinwisteriashinwisteria
提出日時 2018-02-21 22:33:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 1,000 ms
コード長 633 bytes
コンパイル時間 5,474 ms
コンパイル使用メモリ 74,888 KB
実行使用メモリ 57,712 KB
最終ジャッジ日時 2023-10-19 23:59:32
合計ジャッジ時間 10,046 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
57,112 KB
testcase_01 AC 129 ms
57,472 KB
testcase_02 AC 130 ms
57,404 KB
testcase_03 AC 144 ms
57,176 KB
testcase_04 AC 145 ms
57,664 KB
testcase_05 AC 137 ms
57,660 KB
testcase_06 AC 130 ms
57,112 KB
testcase_07 AC 132 ms
57,484 KB
testcase_08 AC 126 ms
57,648 KB
testcase_09 AC 129 ms
57,476 KB
testcase_10 AC 131 ms
57,416 KB
testcase_11 AC 129 ms
57,452 KB
testcase_12 AC 131 ms
57,188 KB
testcase_13 AC 127 ms
57,224 KB
testcase_14 AC 129 ms
57,236 KB
testcase_15 AC 130 ms
57,492 KB
testcase_16 AC 145 ms
57,644 KB
testcase_17 AC 144 ms
57,588 KB
testcase_18 AC 144 ms
57,696 KB
testcase_19 AC 145 ms
57,260 KB
testcase_20 AC 144 ms
57,228 KB
testcase_21 AC 145 ms
57,160 KB
testcase_22 AC 153 ms
57,712 KB
testcase_23 AC 156 ms
57,588 KB
testcase_24 AC 147 ms
57,600 KB
testcase_25 AC 144 ms
57,656 KB
testcase_26 AC 128 ms
57,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con216 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		int[] score = new int[N];
		int[] person = new int[100];

		int rest = 0;
		for(int i = 0;i < N;i++){
			score[i] = s.nextInt();
		}
		for(int i = 0;i < N;i++){
			int num = s.nextInt();
			if(num == 0){
				rest += score[i];
			}else{
				person[num-1] += score[i];
			}
		}
		s.close();

		int max = 0;
		for(int k : person){
			if(k > max){
				max = k;
			}
		}
		if(rest >= max){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

}
0