結果

問題 No.216 FAC
ユーザー Pump0129
提出日時 2018-03-27 22:21:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 986 bytes
コンパイル時間 2,467 ms
コンパイル使用メモリ 80,908 KB
実行使用メモリ 42,044 KB
最終ジャッジ日時 2024-06-25 12:56:01
合計ジャッジ時間 7,215 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

package net.ipipip0129.yukicoder.no216;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

// 課題 Stream API を使う
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int cnt = Integer.parseInt(scan.nextLine());
        int[] point_list = Stream.of(scan.nextLine().split(" "))
                .mapToInt(Integer::parseInt)
                .toArray();
        int[] answers = Stream.of(scan.nextLine().split(" "))
                .mapToInt(Integer::parseInt)
                .toArray();
        int[] get_points = new int[Arrays.stream(answers).max().getAsInt() + 1];

        for (int i = 0; i < point_list.length; i++) get_points[answers[i]] += point_list[i];

        if (get_points[0] == Arrays.stream(get_points).max().getAsInt()) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }

    }
}
0