結果

問題 No.216 FAC
ユーザー spacenaut
提出日時 2016-05-22 17:29:28
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 568 bytes
コンパイル時間 2,066 ms
コンパイル使用メモリ 80,012 KB
実行使用メモリ 56,184 KB
最終ジャッジ日時 2024-10-06 20:35:18
合計ジャッジ時間 7,229 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 RE * 15
権限があれば一括ダウンロードができます

ソースコード

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