結果

問題 No.216 FAC
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-10 22:41:53
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 633 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 75,132 KB
実行使用メモリ 54,888 KB
最終ジャッジ日時 2024-04-24 06:13:21
合計ジャッジ時間 7,463 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,436 KB
testcase_01 AC 137 ms
41,212 KB
testcase_02 AC 139 ms
41,748 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 138 ms
41,360 KB
testcase_08 AC 136 ms
41,656 KB
testcase_09 AC 140 ms
41,580 KB
testcase_10 AC 135 ms
41,496 KB
testcase_11 AC 136 ms
41,796 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 157 ms
41,848 KB
testcase_17 RE -
testcase_18 AC 151 ms
41,760 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 150 ms
41,844 KB
testcase_22 RE -
testcase_23 AC 150 ms
41,872 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

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[n];
		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[n-1]?"YES":"NO");
	}
}
0