結果

問題 No.1043 直列大学
ユーザー tentententen
提出日時 2020-12-03 09:24:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,132 bytes
コンパイル時間 3,491 ms
コンパイル使用メモリ 73,780 KB
実行使用メモリ 58,856 KB
最終ジャッジ日時 2023-10-11 18:12:05
合計ジャッジ時間 10,621 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
40,940 KB
testcase_01 AC 128 ms
40,932 KB
testcase_02 AC 138 ms
40,444 KB
testcase_03 AC 124 ms
40,624 KB
testcase_04 AC 125 ms
41,024 KB
testcase_05 AC 123 ms
40,444 KB
testcase_06 AC 125 ms
40,736 KB
testcase_07 AC 133 ms
40,768 KB
testcase_08 AC 132 ms
40,604 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
testcase_15 RE -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 151 ms
40,916 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MAX = 100 * 1000 + 1;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] volts = new int[MAX];
        volts[0] = 1;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            for (int j = 1000 * i; j >= 0; j--) {
                volts[j + x] += volts[j];
            }
        }
        int[] sums = new int[MAX];
        for (int i = 1; i < MAX; i++) {
            sums[i] += sums[i - 1] + volts[i];
        }
        int[] resists = new int[MAX];
        resists[0] = 1;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            for (int j = 1000 * i; j >= 0; j--) {
                resists[j + x] += resists[j];
            }
        }
        int a = sc.nextInt();
        int b = sc.nextInt();
        long ans = 0;
        for (int i = 1; i * a < MAX; i++) {
            ans += (sums[Math.min(MAX - 1, i * b)] - sums[i * a - 1]) * (long)resists[i];
        }
        System.out.println(ans);
    }
}
0