# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20014 |
2016-02-25T08:30:10 Z |
xdoju |
카드 (kriii4_Z) |
C++14 |
|
1000 ms |
71872 KB |
#include <stdio.h>
const int MOD = 1000000007;
int mul(int x, int y){ return (long long)x * y % MOD; }
int power(int x, int y){
if(y == 0) return 1;
int r = power(x, y / 2);
r = mul(r, r);
if(y % 2 == 1) r = mul(r, x);
return r;
}
int modinv(int x){ return power(x, MOD - 2); }
int dp[3010][3010];
int comb[3010][3010];
int D[3010];
int main(){
int N, L; scanf("%d%d", &N, &L);
for(int i = 1; i <= N; i++) scanf("%d", &D[i]);
comb[0][0] = 1;
for(int i = 1; i <= L; i++){
comb[i][0] = 1;
for(int j = 1; j <= i; j++){
comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
}
}
dp[0][0] = 1;
for(int i = 1; i <= N; i++){
for(int j = 0; j <= L; j++){
for(int k = D[i]; k <= j; k++){
dp[i][j] += mul(dp[i - 1][j - k], comb[j][k]);
dp[i][j] %= MOD;
}
}
}
int moth = power(N, L);
printf("%d\n", mul(dp[N][L], modinv(moth)));
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
71872 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |