結果

問題 No.216 FAC
ユーザー discoNekodiscoNeko
提出日時 2016-04-28 22:37:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 52 ms / 1,000 ms
コード長 816 bytes
コンパイル時間 2,268 ms
コンパイル使用メモリ 77,724 KB
実行使用メモリ 50,436 KB
最終ジャッジ日時 2024-04-23 01:43:03
合計ジャッジ時間 3,826 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
49,788 KB
testcase_01 AC 47 ms
49,860 KB
testcase_02 AC 47 ms
50,032 KB
testcase_03 AC 48 ms
50,332 KB
testcase_04 AC 49 ms
50,044 KB
testcase_05 AC 49 ms
50,288 KB
testcase_06 AC 47 ms
50,056 KB
testcase_07 AC 47 ms
50,420 KB
testcase_08 AC 49 ms
49,956 KB
testcase_09 AC 52 ms
50,020 KB
testcase_10 AC 47 ms
50,296 KB
testcase_11 AC 47 ms
50,016 KB
testcase_12 AC 48 ms
49,804 KB
testcase_13 AC 48 ms
50,124 KB
testcase_14 AC 48 ms
50,308 KB
testcase_15 AC 47 ms
50,132 KB
testcase_16 AC 50 ms
50,144 KB
testcase_17 AC 47 ms
50,260 KB
testcase_18 AC 48 ms
50,048 KB
testcase_19 AC 49 ms
50,264 KB
testcase_20 AC 48 ms
50,436 KB
testcase_21 AC 48 ms
50,384 KB
testcase_22 AC 48 ms
50,264 KB
testcase_23 AC 50 ms
50,388 KB
testcase_24 AC 48 ms
50,176 KB
testcase_25 AC 49 ms
50,012 KB
testcase_26 AC 48 ms
50,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		String[] str1 = br.readLine().split(" ");
		String[] str2 = br.readLine().split(" ");
		int[] p = new int [101];
		int max = 0;
		int sum = 0;
		for(int i = 0; i < n; i++){
			int a = Integer.parseInt(str1[i]);
			int b = Integer.parseInt(str2[i]);
			if(b!=0){
				p[b] += a;
				max = Math.max(max,p[b]);
			}else{
				sum += a;
			}
		}
		if(max>sum){
			sb.append("NO");
		}else{
			sb.append("YES");
		}
		System.out.println(sb);
	}
}
0