結果

問題 No.216 FAC
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-30 14:57:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 1,000 ms
コード長 1,367 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 74,804 KB
実行使用メモリ 49,516 KB
最終ジャッジ日時 2023-10-11 23:40:21
合計ジャッジ時間 4,722 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
47,224 KB
testcase_01 AC 43 ms
49,180 KB
testcase_02 AC 44 ms
49,172 KB
testcase_03 AC 45 ms
49,304 KB
testcase_04 AC 44 ms
49,172 KB
testcase_05 AC 44 ms
49,184 KB
testcase_06 AC 43 ms
49,044 KB
testcase_07 AC 44 ms
49,052 KB
testcase_08 AC 44 ms
49,148 KB
testcase_09 AC 43 ms
49,324 KB
testcase_10 AC 43 ms
49,192 KB
testcase_11 AC 43 ms
49,296 KB
testcase_12 AC 44 ms
49,192 KB
testcase_13 AC 44 ms
49,276 KB
testcase_14 AC 43 ms
49,128 KB
testcase_15 AC 44 ms
47,464 KB
testcase_16 AC 45 ms
49,296 KB
testcase_17 AC 46 ms
49,124 KB
testcase_18 AC 44 ms
49,296 KB
testcase_19 AC 45 ms
49,160 KB
testcase_20 AC 45 ms
49,308 KB
testcase_21 AC 46 ms
49,168 KB
testcase_22 AC 45 ms
49,156 KB
testcase_23 AC 45 ms
49,280 KB
testcase_24 AC 45 ms
49,516 KB
testcase_25 AC 46 ms
49,168 KB
testcase_26 AC 43 ms
49,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import static java.lang.System.in;


public class Main {
    public static void main(String[] args) throws IOException {
        int numOfParticipants = 100;
        int[] pointsOfParticipants = new int[numOfParticipants + 1];
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int N = Integer.parseInt(reader.readLine());
        String[] scores = reader.readLine().split(" ");
        String[] solvedByArray = reader.readLine().split(" ");
        for (int i = 0; i < N; i++) {
            int solvedBy = Integer.parseInt(solvedByArray[i]);
            int score = Integer.parseInt(scores[i]);
            if (solvedBy == 0) {
                pointsOfParticipants[100] += score;
            } else {
                pointsOfParticipants[solvedBy-1] += score;
            }
        }

        int champion = 0;
        int maxSoFar = Integer.MIN_VALUE;
        for (int i = 0; i < numOfParticipants+1; i++) {
            if (pointsOfParticipants[i] >= maxSoFar) {
                maxSoFar = pointsOfParticipants[i];
                champion = i;
            }
        }
        if(champion==100) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
}
0