Submission #23222

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
232222017-05-05 06:56:39aintahi (KRIII5_HI)C++14
2 / 7
500 ms7128 KiB
#include<cstdio>
#include<algorithm>
using namespace std;
int P[110], Mod = 1000000007, n, w[60], F[5110], InvF[5110], C[110][110];
int D[128][5010], Comb[5110][110], Num[60], TP[60][5010], CC[110][110];
int Pow(int a, int b){
int r = 1;
while(b){
if(b&1)r=1ll*r*a%Mod;
a=1ll*a*a%Mod;b>>=1;
}
return r;
}
void Do(int nd, int b, int e, int sum){
if(b==e){
Num[b] = nd;
return;
}
int m = (b+e)>>1, i, j, k, ss = sum;
for(i=0;i<=sum;i++)TP[0][i] = D[nd][i];
for(i=1;i<=m-b+1;i++)for(j=0;j<=5000;j++)TP[i][j] = 0;
for(i=0;i<=m-b;i++){
for(j=0;j<=ss;j++){
for(k=1;k<=w[i+b];k++){
TP[i+1][j+k] = (TP[i+1][j+k] + 1ll * Comb[j+k][k] * C[w[i+b]][k] % Mod * TP[i][j])%Mod;
}
}
ss += w[b+i];
}
for(i=0;i<=ss;i++)D[nd+nd+1][i] = TP[m-b+1][i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

HI.cpp: In function 'int main()':
HI.cpp:72:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
HI.cpp:75:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&w[i]);
                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...