結果
問題 | No.1043 直列大学 |
ユーザー | joybeeee |
提出日時 | 2020-05-13 20:17:10 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,414 bytes |
コンパイル時間 | 1,961 ms |
コンパイル使用メモリ | 73,928 KB |
実行使用メモリ | 58,876 KB |
最終ジャッジ日時 | 2023-10-12 17:03:29 |
合計ジャッジ時間 | 13,074 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 166 ms
58,528 KB |
testcase_01 | AC | 147 ms
57,844 KB |
testcase_02 | AC | 197 ms
58,876 KB |
testcase_03 | AC | 147 ms
57,640 KB |
testcase_04 | AC | 146 ms
57,696 KB |
testcase_05 | AC | 145 ms
57,676 KB |
testcase_06 | AC | 146 ms
57,672 KB |
testcase_07 | AC | 165 ms
58,620 KB |
testcase_08 | AC | 159 ms
58,260 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 411 ms
58,312 KB |
testcase_12 | WA | - |
testcase_13 | AC | 389 ms
58,172 KB |
testcase_14 | AC | 394 ms
58,376 KB |
testcase_15 | AC | 419 ms
57,780 KB |
testcase_16 | AC | 387 ms
58,524 KB |
testcase_17 | AC | 325 ms
58,244 KB |
testcase_18 | WA | - |
testcase_19 | AC | 385 ms
58,220 KB |
testcase_20 | AC | 324 ms
58,724 KB |
testcase_21 | AC | 368 ms
58,736 KB |
testcase_22 | AC | 378 ms
58,228 KB |
testcase_23 | AC | 433 ms
57,932 KB |
testcase_24 | AC | 355 ms
58,244 KB |
testcase_25 | AC | 391 ms
58,080 KB |
testcase_26 | AC | 405 ms
57,832 KB |
testcase_27 | AC | 273 ms
58,288 KB |
testcase_28 | AC | 384 ms
58,236 KB |
testcase_29 | AC | 224 ms
58,588 KB |
testcase_30 | AC | 329 ms
58,228 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int mod = 1000000007; int n = sc.nextInt(); int m = sc.nextInt(); int[] vArr = new int[n]; int[] rArr = new int[m]; for(int i = 0; i < n; i++) vArr[i] = sc.nextInt(); for(int i = 0; i < m; i++) rArr[i] = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); long[] dpV = new long[101010]; dpV[0] = 1L; long[] dpR = new long[101010]; dpR[0] = 1L; for(int i = 0; i < n; i++) for(int j = dpV.length - 1; j > 0; j--) { if(j - vArr[i] < 0) continue; dpV[j] = (dpV[j] + dpV[j - vArr[i]]) % mod; } for(int i = 0; i < m; i++) for(int j = dpR.length - 1; j > 0; j--) { if(j - rArr[i] < 0) continue; dpR[j] = (dpR[j] + dpR[j - rArr[i]]) % mod; } for(int i = 1; i < dpV.length; i++) dpV[i] = (dpV[i] + dpV[i-1]); long cnt = 0L; for(int r = 1; r < dpR.length; r++) { if(dpR[r] == 0) continue; long leftV = a * r; long rightV = b * r; if(leftV > dpV.length - 1) continue; rightV = Math.min(rightV, dpV.length - 1); cnt = cnt + (long)dpR[r] * (dpV[(int)rightV] - dpV[(int)leftV - 1]) % mod; } System.out.println(cnt % mod); } }