結果

問題 No.216 FAC
ユーザー 4A9GN4A9GN
提出日時 2016-07-21 22:48:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 1,000 ms
コード長 1,276 bytes
コンパイル時間 2,109 ms
コンパイル使用メモリ 79,012 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-04-24 01:14:06
合計ジャッジ時間 6,616 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
40,864 KB
testcase_01 AC 121 ms
41,384 KB
testcase_02 AC 116 ms
41,020 KB
testcase_03 AC 127 ms
41,252 KB
testcase_04 AC 122 ms
41,352 KB
testcase_05 AC 126 ms
41,340 KB
testcase_06 AC 113 ms
41,296 KB
testcase_07 AC 112 ms
39,900 KB
testcase_08 AC 119 ms
40,940 KB
testcase_09 AC 122 ms
41,092 KB
testcase_10 AC 119 ms
41,076 KB
testcase_11 AC 119 ms
41,224 KB
testcase_12 AC 123 ms
41,428 KB
testcase_13 AC 123 ms
41,324 KB
testcase_14 AC 124 ms
41,384 KB
testcase_15 AC 122 ms
41,416 KB
testcase_16 AC 131 ms
41,548 KB
testcase_17 AC 131 ms
41,472 KB
testcase_18 AC 137 ms
41,540 KB
testcase_19 AC 133 ms
41,468 KB
testcase_20 AC 130 ms
41,548 KB
testcase_21 AC 140 ms
41,708 KB
testcase_22 AC 127 ms
41,684 KB
testcase_23 AC 130 ms
41,140 KB
testcase_24 AC 128 ms
41,368 KB
testcase_25 AC 128 ms
41,036 KB
testcase_26 AC 116 ms
41,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    static public void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int size = sc.nextInt();
        int emptyScore = 0;
        int i;
        ArrayList<Integer> scoreList = new ArrayList<Integer>();
        for (i = 0; i < size; i++) //各問題の点数記録
            scoreList.add(sc.nextInt());
        ArrayList<Integer> answerList = new ArrayList<Integer>();
        for (i = 0; i < size; i++) //各問題の正答者記録
            answerList.add(sc.nextInt());
        ArrayList<Integer> peopleScore = new ArrayList<Integer>(); //出場者番号ごとの点数
	for (i = 0; i < 101; i++) 
            peopleScore.add(i, 0);
        for (i = 0; i < size; i++) {
            if (answerList.get(i) > 0) {
		int peopleNum = answerList.get(i);
                int peopleSc = peopleScore.get(peopleNum);
                int addScore = scoreList.get(i);
                peopleScore.set(peopleNum, peopleSc+addScore);
            } else emptyScore += scoreList.get(i);
        }
        if (emptyScore >= Collections.max(peopleScore))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}
0