Submission #2235796
Source Code Expand
#include <iostream>
#include <vector>
#include <string>
#include <memory.h>
using namespace std;
const int N = 510;
#define mod 1000000007
int dp[N][N], n, arr[N],arr2[N], c , cur[N][N];
int calc(int i, int j) {
if (i == n)
return (j == 0);
int &ret = dp[i][j];
if (ret != -1)
return ret;
ret = 0;
for (int k = j; k >= 0; k--) {
ret += (long long)cur[i][j-k] * calc(i + 1, k) % mod;
ret %= mod;
}
return ret;
}
int fastpower(int num, int po) {
if (po == 0) return 1;
int cur = fastpower(num, po >> 1);
cur = (long long)cur * cur % mod;
if (po & 1) cur = (long long)cur * num % mod;
return cur;
}
int main() {
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
scanf("%d%d", &n,&c);
for (int i = 0; i < n; i++)
scanf("%d", &arr[i]);
for (int i = 0; i < n; i++) {
scanf("%d", &arr2[i]);
for (int k = 0; k <= c;k++) {
for (int j = arr[i]; j <= arr2[i]; j++) {
cur[i][k] += fastpower(j, k);
cur[i][k] %= mod;
}
}
}
memset(dp, -1, sizeof(dp));
cout << calc(0, c) << endl;
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:35:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &n,&c);
^
./Main.cpp:37:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &arr[i]);
^
./Main.cpp:39:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &arr2[i]);
^
Judge Result
Set Name |
Sample |
Subtask |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
400 / 400 |
Status |
|
|
|
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 |
2 ms |
1280 KB |
0_001.txt |
AC |
2 ms |
1280 KB |
0_002.txt |
AC |
2 ms |
1280 KB |
0_003.txt |
AC |
2 ms |
1280 KB |
0_004.txt |
AC |
2 ms |
1280 KB |
1_005.txt |
AC |
2 ms |
1280 KB |
1_006.txt |
AC |
2 ms |
1280 KB |
1_007.txt |
AC |
2 ms |
1280 KB |
1_008.txt |
AC |
2 ms |
1280 KB |
1_009.txt |
AC |
2 ms |
1280 KB |
1_010.txt |
AC |
2 ms |
1280 KB |
1_011.txt |
AC |
2 ms |
2048 KB |
1_012.txt |
AC |
2 ms |
2048 KB |
1_013.txt |
AC |
2 ms |
2048 KB |
1_014.txt |
AC |
200 ms |
2048 KB |
1_015.txt |
AC |
200 ms |
2048 KB |
1_016.txt |
AC |
200 ms |
2048 KB |
2_017.txt |
AC |
2 ms |
1280 KB |
2_018.txt |
AC |
2 ms |
1280 KB |
2_019.txt |
AC |
11 ms |
1280 KB |
2_020.txt |
AC |
8 ms |
1280 KB |
2_021.txt |
AC |
4 ms |
2048 KB |
2_022.txt |
AC |
3 ms |
2048 KB |
2_023.txt |
AC |
3797 ms |
2048 KB |
2_024.txt |
AC |
1436 ms |
2048 KB |
2_025.txt |
AC |
397 ms |
2048 KB |
2_026.txt |
AC |
22 ms |
1920 KB |
2_027.txt |
AC |
1165 ms |
2048 KB |
2_028.txt |
AC |
53 ms |
1536 KB |
2_029.txt |
AC |
16 ms |
1280 KB |