結果

問題 No.216 FAC
ユーザー spacenautspacenaut
提出日時 2016-05-22 17:29:28
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 568 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 75,396 KB
実行使用メモリ 41,952 KB
最終ジャッジ日時 2024-04-16 06:48:43
合計ジャッジ時間 7,254 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,392 KB
testcase_01 AC 135 ms
41,112 KB
testcase_02 AC 136 ms
41,520 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 137 ms
41,836 KB
testcase_08 AC 139 ms
41,452 KB
testcase_09 AC 136 ms
41,680 KB
testcase_10 AC 137 ms
41,452 KB
testcase_11 AC 137 ms
41,488 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 154 ms
41,952 KB
testcase_17 RE -
testcase_18 AC 150 ms
41,884 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 149 ms
41,872 KB
testcase_22 RE -
testcase_23 AC 150 ms
41,516 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class No0216{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int tm = 0;
		String cnt = "YES";
		ArrayList<Integer> a = new ArrayList<Integer>();
		ArrayList<Integer> b = new ArrayList<Integer>();

		for(int i = 0; i < n; i++){
			a.add(sc.nextInt());
			b.add(0);
		}

		for(int i = 0; i < n; i++){
			tm = sc.nextInt();
			b.set(tm, b.get(tm) + a.get(i));
		}

		for(int i = 1; i < n; i++){
			if(b.get(0) < b.get(i)){
				cnt = "NO";
				break;
			}
		}
		System.out.println(cnt);
	}
}
0