# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20025 |
2016-02-25T08:41:27 Z |
Namnamseo |
카드 (kriii4_Z) |
C++14 |
|
8 ms |
87868 KB |
#include<cstdio>
#include<cstring>
long long a,b,i,c,aa,bb=1,x,X=1e9+7,D[3333][3333];
long long pow(long long aa,long long bb){
if(bb==0) return 1;
long long ret=pow(aa,bb/2);
ret=(ret*ret)%X;
if(bb&1) ret=(ret*aa)%X;
return ret;
}
long long f(long long C,long long L)
{
if(D[C][L]>=0)return D[C][L];
if(L==0)return D[C][L]=0;
if(C>L)return D[C][L]=0;
if(C==1&&L==1)return D[C][L]=1;
return D[C][L]=(C*f(C-1,L-1)%X+(a-C)*f(C,L-1)%X)%X;
}
main()
{
memset(D,-1,sizeof(D));
scanf("%lld%lld",&a,&b);
for(i=1;i<=a;i++){scanf("%lld",&x);if(x==1)c++;};
aa=f(c,b);
for(i=1;i<=a;i++)bb*=a,bb%=X;
printf("%lld",aa*pow(bb,X-2)%X);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
87868 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |