結果

問題 No.216 FAC
コンテスト
ユーザー 4A9GN
提出日時 2016-07-21 22:48:29
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 66 ms / 1,000 ms
+ 972µs
コード長 1,276 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,528 ms
コンパイル使用メモリ 88,668 KB
実行使用メモリ 43,608 KB
最終ジャッジ日時 2026-09-19 14:24:09
合計ジャッジ時間 5,136 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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