Contest Duration: - (local time) (100 minutes) Back to Home

Submission #837056

Source Code Expand

Copy
```#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <queue>

using namespace std;

#define pb push_back
#define pbk pop_back
#define fs first
#define sc second
#define sz(s) ((int) (s).size())
#define all(x) (x).begin(), (x).end()
#define mt make_tuple
#define mp make_pair
#define next hunext
#define prev huprev

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;

const int inf = 1e9;
const double pi = 4 * atan(1.0);
const double eps = 1e-9;
const int N = 444;
const int MOD = int(1e9) + 7;

int a[N], b[N];
int dp[N][N], sum[N][N], pw[N][N];

inline int get_sum(int x, int l, int r) {
assert(l <= r);
return sum[x][r] - (l > 0 ? sum[x][l - 1] : 0);
}

int main() {
#ifdef LOCAL42
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
scanf("%d", a + i);
}
for (int i = 1; i <= n; ++i) {
scanf("%d", b + i);
}
for (int i = 1; i < N; ++i) {
pw[i][0] = 1;
for (int j = 1; j < N; ++j) {
pw[i][j] = (1LL * pw[i][j - 1] * i) % MOD;
}
}
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
sum[i][j] = (j > 0 ? sum[i][j - 1] : 0) + pw[j][i];
if (sum[i][j] >= MOD) {
sum[i][j] -= MOD;
}
}
}
dp[0][0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j <= m; ++j) {
for (int z = 0; z <= j; ++z) {
dp[i][j] = (dp[i][j] + 1LL * get_sum(z, a[i], b[i]) * dp[i - 1][j - z]) % MOD;
}
}
}
cout << dp[n][m] << endl;
return 0;
}
```

#### Submission Info

Submission Time 2016-08-13 21:28:38+0900 E - Children and Candies sankear C++14 (GCC 5.4.1) 0 2091 Byte WA 270 ms 2432 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:60:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", a + i);
^
./Main.cpp:63:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", b + i);
^
```

#### Judge Result

Score / Max Score 0 / 0 0 / 400 0 / 400
Status
 AC × 5
 AC × 10 WA × 2
 AC × 25 WA × 5
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt
Subtask 0_001, 0_003, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 2_017.txt, 2_018.txt, 2_019.txt, 2_020.txt, 2_021.txt, 2_022.txt, 2_023.txt, 2_024.txt, 2_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt
Case Name Status Exec Time Memory
0_000.txt AC 10 ms 1792 KB
0_001.txt AC 10 ms 1792 KB
0_002.txt AC 9 ms 1792 KB
0_003.txt AC 10 ms 1792 KB
0_004.txt AC 10 ms 1792 KB
1_005.txt AC 9 ms 1792 KB
1_006.txt AC 10 ms 1792 KB
1_007.txt AC 9 ms 1792 KB
1_008.txt AC 10 ms 1792 KB
1_009.txt WA 10 ms 1792 KB
1_010.txt AC 10 ms 1792 KB
1_011.txt AC 11 ms 2432 KB
1_012.txt AC 11 ms 2432 KB
1_013.txt AC 11 ms 2432 KB
1_014.txt AC 266 ms 2432 KB
1_015.txt WA 268 ms 2432 KB
1_016.txt AC 267 ms 2432 KB
2_017.txt AC 9 ms 1792 KB
2_018.txt AC 9 ms 1792 KB
2_019.txt AC 10 ms 1792 KB
2_020.txt AC 10 ms 1792 KB
2_021.txt AC 11 ms 2432 KB
2_022.txt AC 11 ms 2432 KB
2_023.txt AC 270 ms 2432 KB
2_024.txt WA 270 ms 2432 KB
2_025.txt WA 51 ms 2432 KB
2_026.txt WA 11 ms 2304 KB
2_027.txt AC 215 ms 2432 KB
2_028.txt AC 13 ms 1920 KB
2_029.txt AC 10 ms 1792 KB