結果

問題 No.216 FAC
ユーザー 37zigen37zigen
提出日時 2016-03-10 02:06:17
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 665 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 75,464 KB
実行使用メモリ 58,008 KB
最終ジャッジ日時 2023-10-24 22:17:14
合計ジャッジ時間 6,991 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
57,512 KB
testcase_01 AC 125 ms
57,424 KB
testcase_02 AC 126 ms
57,544 KB
testcase_03 RE -
testcase_04 AC 135 ms
57,600 KB
testcase_05 RE -
testcase_06 AC 114 ms
56,200 KB
testcase_07 AC 120 ms
57,172 KB
testcase_08 AC 112 ms
56,308 KB
testcase_09 AC 123 ms
57,516 KB
testcase_10 AC 125 ms
57,480 KB
testcase_11 AC 124 ms
57,420 KB
testcase_12 AC 126 ms
57,532 KB
testcase_13 RE -
testcase_14 AC 129 ms
57,600 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 139 ms
57,668 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
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];
		int[] p=new int[100];
		int sum=0;
		Arrays.fill(p, 0);
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			int b=sc.nextInt();
			if(b==0){
				sum+=a[i];
			}else{
				p[b+1]+=a[i];
			}
		}
		int max=0;
		for(int i=0;i<100;i++){
			if(max<p[i]){
				max=p[i];
			}
		}
		//System.out.println(sum+"sum "+max+"max");
		if(max>sum){
			System.out.println("NO");
		}else if(max<=sum){
			System.out.println("YES");
		}
	}
}
0