結果

問題 No.216 FAC
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-05-07 22:22:10
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 725 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 71,916 KB
実行使用メモリ 58,424 KB
最終ジャッジ日時 2023-09-10 10:58:27
合計ジャッジ時間 6,985 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,968 KB
testcase_01 AC 122 ms
55,872 KB
testcase_02 AC 127 ms
55,444 KB
testcase_03 RE -
testcase_04 AC 131 ms
56,172 KB
testcase_05 RE -
testcase_06 AC 126 ms
55,876 KB
testcase_07 AC 123 ms
54,120 KB
testcase_08 AC 124 ms
55,668 KB
testcase_09 AC 122 ms
55,816 KB
testcase_10 AC 124 ms
55,736 KB
testcase_11 AC 126 ms
57,760 KB
testcase_12 AC 123 ms
53,952 KB
testcase_13 RE -
testcase_14 AC 124 ms
55,984 KB
testcase_15 RE -
testcase_16 AC 140 ms
56,144 KB
testcase_17 RE -
testcase_18 AC 140 ms
55,768 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 142 ms
55,672 KB
testcase_22 RE -
testcase_23 AC 142 ms
55,908 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        int[] c = new int[100];
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        int k_score = 0;
        for(int i = 0; i < n; i++) {
            b[i] = in.nextInt();
            if(b[i] == 0) k_score += a[i];
            else c[b[i]] += a[i];
        }

        String ans = "YES";
        for(int i = 0; i < 100; i++) {
            if(c[i] > k_score) {
                ans = "NO";
                break;
            }
        }
        System.out.println(ans);
    }
}
0