結果
| 問題 | No.1043 直列大学 |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-12-03 09:24:37 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,132 bytes |
| 記録 | |
| コンパイル時間 | 5,274 ms |
| コンパイル使用メモリ | 76,624 KB |
| 実行使用メモリ | 58,180 KB |
| 最終ジャッジ日時 | 2024-09-13 17:08:27 |
| 合計ジャッジ時間 | 10,837 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 10 RE * 11 |
ソースコード
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);
}
}
tenten