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

Submission #837587

Source Code Expand

Copy
```#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <iomanip>
#include <bitset>

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)

typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef pair<ll, ll> pll;

const int N = 400 + 7;
const int M = 30;
const int inf = 1e9 + 7;
const long long linf = (ll) inf * inf + 7;
const double pi = acos(-1);
const double eps = 1e-20;
const bool multipleTest = false;

int f[N][N];

int n, C;
int a[N], b[N];

ll dp[N][N];

void solve() {
for(int u = 1; u < N; ++u) {
f[u][0] = u;
int t = u;
for(int c = 1; c < N; ++c) {
f[u][c] = (f[u - 1][c] + t) % inf;
t = (ll) t * u % inf;
}
}
cin >> n >> C;
for(int i = 1; i <= n; ++i) scanf("%d", a + i);
for(int j = 1; j <= n; ++j) scanf("%d", b + j);
dp[0][0] = 1;
for(int i = 1; i <= n; ++i) {
dp[i][0] = dp[i - 1][0] * (f[b[i]][0] - f[a[i] - 1][0] + inf) % inf;
for(int c = 1; c <= C; ++c) {
for(int cur = 0; cur <= c; ++cur) {
dp[i][c] = (dp[i][c] + dp[i - 1][c - cur] * (f[b[i]][cur] - f[a[i] - 1][cur] + inf)) % inf;
}
}
}

cout << dp[n][C];

}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    auto t1 = clock();
//#endif

int Test = 1;
if (multipleTest) {
cin >> Test;
}

for(int i = 0; i < Test; ++i) {
solve();
}

//#ifndef ONLINE_JUDGE
//    printf("\n%.9lf\n", (0.0 + clock() - t1) / CLOCKS_PER_SEC);
//#endif
}```

#### Submission Info

Submission Time 2016-08-13 21:46:18+0900 E - Children and Candies creatnx C++14 (GCC 5.4.1) 800 2490 Byte AC 269 ms 2176 KB

#### Compile Error

```./Main.cpp: In function ‘void solve()’:
./Main.cpp:68:51: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int i = 1; i <= n; ++i) scanf("%d", a + i);
^
./Main.cpp:69:51: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int j = 1; j <= n; ++j) scanf("%d", b + j);
^
```

#### Judge Result

Score / Max Score 0 / 0 400 / 400 400 / 400
Status
 AC × 5
 AC × 12
 AC × 30
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 11 ms 1280 KB
0_001.txt AC 7 ms 896 KB
0_002.txt AC 7 ms 896 KB
0_003.txt AC 7 ms 896 KB
0_004.txt AC 7 ms 896 KB
1_005.txt AC 7 ms 896 KB
1_006.txt AC 7 ms 896 KB
1_007.txt AC 7 ms 896 KB
1_008.txt AC 7 ms 896 KB
1_009.txt AC 7 ms 896 KB
1_010.txt AC 7 ms 896 KB
1_011.txt AC 9 ms 2176 KB
1_012.txt AC 8 ms 2176 KB
1_013.txt AC 9 ms 2176 KB
1_014.txt AC 267 ms 2176 KB
1_015.txt AC 268 ms 2176 KB
1_016.txt AC 269 ms 2176 KB
2_017.txt AC 7 ms 896 KB
2_018.txt AC 7 ms 896 KB
2_019.txt AC 7 ms 896 KB
2_020.txt AC 7 ms 896 KB
2_021.txt AC 8 ms 2176 KB
2_022.txt AC 9 ms 2176 KB
2_023.txt AC 267 ms 2176 KB
2_024.txt AC 267 ms 2176 KB
2_025.txt AC 49 ms 2176 KB
2_026.txt AC 9 ms 1920 KB
2_027.txt AC 213 ms 2048 KB
2_028.txt AC 11 ms 1280 KB
2_029.txt AC 8 ms 1024 KB