結果

問題 No.216 FAC
ユーザー Tsukasa_Type
提出日時 2018-02-10 22:44:47
言語 Java
(openjdk 23)
結果
AC  
実行時間 152 ms / 1,000 ms
コード長 633 bytes
コンパイル時間 2,603 ms
コンパイル使用メモリ 75,240 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2024-11-06 13:30:30
合計ジャッジ時間 7,586 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] score = new int[n];
		for (int i=0; i<n; i++) {
			score[i] = sc.nextInt();
		}
		int[] num = new int[n];
		int[] got_score = new int[101];
		for (int i=0; i<n; i++) {
			num[i] = sc.nextInt();
			got_score[num[i]] += score[i];
		}
		
		int myscore = got_score[0]; //主人公のスコアを避難させる
		got_score[0] = 0; //主人公のスコアを消して……
		Arrays.sort(got_score); //ソート。	
		System.out.println(myscore>=got_score[100]?"YES":"NO");
	}
}
0