結果

問題 No.216 FAC
ユーザー dazydazy
提出日時 2017-02-23 21:10:40
言語 Java19
(openjdk 21)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 872 bytes
コンパイル時間 3,805 ms
コンパイル使用メモリ 88,992 KB
実行使用メモリ 56,276 KB
最終ジャッジ日時 2023-08-30 21:36:16
合計ジャッジ時間 9,593 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,408 KB
testcase_01 AC 121 ms
56,164 KB
testcase_02 AC 121 ms
55,724 KB
testcase_03 AC 133 ms
55,704 KB
testcase_04 AC 126 ms
55,920 KB
testcase_05 AC 124 ms
55,940 KB
testcase_06 AC 118 ms
55,988 KB
testcase_07 AC 123 ms
55,728 KB
testcase_08 AC 124 ms
55,796 KB
testcase_09 AC 124 ms
55,864 KB
testcase_10 AC 124 ms
55,960 KB
testcase_11 AC 124 ms
55,704 KB
testcase_12 AC 123 ms
55,448 KB
testcase_13 AC 126 ms
55,688 KB
testcase_14 AC 125 ms
55,860 KB
testcase_15 AC 123 ms
55,980 KB
testcase_16 AC 141 ms
55,720 KB
testcase_17 AC 140 ms
55,920 KB
testcase_18 AC 140 ms
55,636 KB
testcase_19 AC 141 ms
54,476 KB
testcase_20 AC 142 ms
56,276 KB
testcase_21 AC 138 ms
55,692 KB
testcase_22 AC 142 ms
55,968 KB
testcase_23 AC 141 ms
55,672 KB
testcase_24 AC 139 ms
56,004 KB
testcase_25 AC 139 ms
55,608 KB
testcase_26 AC 123 ms
56,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        String ans = "YES";
        int N = scan.nextInt();
        ArrayList<Integer> point = new ArrayList<>();
        HashMap<Integer, Integer> solver = new HashMap<>();
        int tmp;

        for (int i = 0; i < N; i++) point.add(scan.nextInt());
        for (int i = 0; i < N; i++) {
            tmp = scan.nextInt();
            if (solver.containsKey(tmp)) solver.put(tmp, solver.get(tmp) + point.get(i));
            else solver.put(tmp, point.get(i));
        }

        if (!solver.containsKey(0)) ans = "NO";
        else {
            int max;
            max = solver.values().stream().max((a, b) -> a.compareTo(b)).get();
            if (solver.get(0) < max) ans = "NO";
        }

        System.out.println(ans);
    }
}
0