結果

問題 No.1043 直列大学
ユーザー tentententen
提出日時 2020-12-03 09:37:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,317 bytes
コンパイル時間 2,502 ms
コンパイル使用メモリ 73,556 KB
実行使用メモリ 60,668 KB
最終ジャッジ日時 2023-10-11 18:27:14
合計ジャッジ時間 9,151 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
57,980 KB
testcase_01 AC 136 ms
57,840 KB
testcase_02 AC 143 ms
58,112 KB
testcase_03 AC 133 ms
57,820 KB
testcase_04 AC 133 ms
57,912 KB
testcase_05 AC 134 ms
57,660 KB
testcase_06 AC 135 ms
57,988 KB
testcase_07 AC 146 ms
57,816 KB
testcase_08 AC 143 ms
57,740 KB
testcase_09 AC 172 ms
58,480 KB
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 AC 183 ms
58,360 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 171 ms
58,616 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MAX = 100 * 1000 + 1;
    static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] volts = new long[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];
                volts[j + x] %= MOD;
            }
        }
        long[] sums = new long[MAX];
        for (int i = 1; i < MAX; i++) {
            sums[i] += sums[i - 1] + volts[i];
            sums[i] %= MOD;
        }
        long[] resists = new long[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];
                resists[j + x] %= MOD;
            }
        }
        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] + MOD) % MOD * resists[i] % MOD;
            ans %= MOD;
        }
        System.out.println(ans);
    }
}
0