結果

問題 No.216 FAC
ユーザー 練習生練習生
提出日時 2015-08-18 08:13:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 903 bytes
コンパイル時間 3,496 ms
コンパイル使用メモリ 72,264 KB
実行使用メモリ 57,928 KB
最終ジャッジ日時 2023-09-25 12:46:47
合計ジャッジ時間 8,155 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,528 KB
testcase_01 AC 128 ms
55,976 KB
testcase_02 AC 125 ms
56,128 KB
testcase_03 AC 140 ms
55,864 KB
testcase_04 AC 131 ms
57,928 KB
testcase_05 AC 131 ms
55,952 KB
testcase_06 AC 131 ms
55,532 KB
testcase_07 AC 126 ms
55,624 KB
testcase_08 AC 129 ms
55,668 KB
testcase_09 AC 126 ms
55,740 KB
testcase_10 AC 127 ms
55,624 KB
testcase_11 AC 125 ms
53,808 KB
testcase_12 AC 126 ms
55,976 KB
testcase_13 WA -
testcase_14 AC 128 ms
55,472 KB
testcase_15 WA -
testcase_16 AC 146 ms
55,856 KB
testcase_17 AC 142 ms
53,840 KB
testcase_18 AC 141 ms
55,724 KB
testcase_19 AC 148 ms
56,124 KB
testcase_20 AC 144 ms
55,496 KB
testcase_21 AC 142 ms
55,900 KB
testcase_22 AC 141 ms
55,620 KB
testcase_23 AC 144 ms
55,916 KB
testcase_24 AC 144 ms
55,752 KB
testcase_25 AC 146 ms
55,656 KB
testcase_26 AC 126 ms
56,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No216 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int kScore = 0;
		int n = sc.nextInt();
		int[] score = new int[n];
		int[] answer = new int[100];
		// スコア一覧を配列に格納
		for(int i = 0; i < n; i++){
			score[i] = sc.nextInt();
		}
		// 解答者に得点を追加
		for(int i = 0; i < n; i++){
			int kaitou = sc.nextInt();
			if(kaitou != 0){
				// 解答者がいる場合
				kaitou--;
				answer[kaitou] += score[i];
			}else{
				// 解答者がいない場合
				kScore += score[i];
			}
		}
		sc.close();
		// k君以外の解答者で最高得点のものを検索
		int max = 0;
		for(int i = 0; i < n; i++){
			if(answer[i] > max){
				max = answer[i];
			}
		}
		// 優勝できるか判定
		if(kScore >= max){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}
0