結果

問題 No.216 FAC
ユーザー mits58mits58
提出日時 2016-07-02 18:31:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 549 bytes
コンパイル時間 1,822 ms
コンパイル使用メモリ 74,924 KB
実行使用メモリ 41,996 KB
最終ジャッジ日時 2024-04-23 01:45:05
合計ジャッジ時間 5,860 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
41,248 KB
testcase_01 AC 107 ms
41,420 KB
testcase_02 AC 103 ms
41,340 KB
testcase_03 AC 126 ms
41,884 KB
testcase_04 AC 126 ms
41,832 KB
testcase_05 AC 117 ms
41,808 KB
testcase_06 AC 113 ms
41,584 KB
testcase_07 AC 116 ms
41,728 KB
testcase_08 AC 105 ms
41,208 KB
testcase_09 AC 119 ms
41,628 KB
testcase_10 AC 113 ms
41,688 KB
testcase_11 AC 116 ms
41,756 KB
testcase_12 AC 111 ms
41,428 KB
testcase_13 AC 112 ms
41,392 KB
testcase_14 AC 121 ms
41,736 KB
testcase_15 AC 120 ms
41,456 KB
testcase_16 AC 128 ms
41,588 KB
testcase_17 AC 129 ms
41,688 KB
testcase_18 AC 130 ms
41,540 KB
testcase_19 AC 129 ms
41,684 KB
testcase_20 AC 123 ms
41,724 KB
testcase_21 AC 124 ms
41,536 KB
testcase_22 AC 124 ms
41,684 KB
testcase_23 AC 129 ms
41,724 KB
testcase_24 AC 129 ms
41,996 KB
testcase_25 AC 132 ms
41,972 KB
testcase_26 AC 118 ms
41,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int[] p=new int[101];
			int sum=0;
			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();
			for(int i=0;i<n;i++){
				if(b[i]==0) sum+=a[i];
				p[b[i]]+=a[i];
			}
			Arrays.sort(p);
			if(p[100]==sum) System.out.println("YES");
			else System.out.println("NO");
		}
	}
}
0