Submission #4049753
Source Code Expand
#include<algorithm> #include<cstdio> #define mxn 2010 using namespace std; const int mod=1e9+7; int n,m,sum,ans,fac[mxn],ifc[mxn]; int pow(int k,int i) { int t=1; while(i) { if(i&1) t=1ll*t*k%mod; k=1ll*k*k%mod;i>>=1; } return t; } int C(int x,int y) { if(x<y) return 0; return 1ll*fac[x]*ifc[y]%mod*ifc[x-y]%mod; } int main() { scanf("%d%d",&n,&m);fac[0]=1;int x,y;ans=n+1; for(int i=1;i<=n+1;++i) fac[i]=1ll*fac[i-1]*i%mod; ifc[n+1]=pow(fac[n+1],mod-2); for(int i=n;~i;--i) ifc[i]=1ll*ifc[i+1]*(i+1)%mod; for(int i=1;i<=m;++i) for(int j=1;j<=m-i;++j) { x=m-i;y=x-j; sum=1ll*C(x+i-1,x)*C(y+j-1,y)%mod; sum=1ll*sum*C(n-x-y+2,2)%mod; ans+=sum;if(ans>=mod) ans-=mod; } printf("%d\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Popping Balls |
User | lzoilxy |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 734 Byte |
Status | WA |
Exec Time | 40 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:24:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&n,&m);fac[0]=1;int x,y;ans=n+1; ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1600 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0.txt, example1.txt, example2.txt, example3.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, example0.txt, example1.txt, example2.txt, example3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | AC | 40 ms | 128 KB |
001.txt | WA | 26 ms | 128 KB |
002.txt | AC | 1 ms | 128 KB |
003.txt | AC | 1 ms | 128 KB |
004.txt | WA | 34 ms | 128 KB |
005.txt | WA | 34 ms | 128 KB |
006.txt | AC | 38 ms | 128 KB |
007.txt | WA | 31 ms | 128 KB |
008.txt | WA | 32 ms | 128 KB |
009.txt | WA | 33 ms | 128 KB |
010.txt | WA | 34 ms | 128 KB |
011.txt | AC | 39 ms | 128 KB |
012.txt | AC | 37 ms | 128 KB |
013.txt | WA | 32 ms | 128 KB |
014.txt | WA | 24 ms | 128 KB |
015.txt | AC | 10 ms | 128 KB |
016.txt | WA | 19 ms | 128 KB |
017.txt | WA | 13 ms | 128 KB |
018.txt | WA | 23 ms | 128 KB |
019.txt | WA | 25 ms | 128 KB |
020.txt | AC | 5 ms | 128 KB |
021.txt | WA | 7 ms | 128 KB |
022.txt | WA | 15 ms | 128 KB |
023.txt | WA | 14 ms | 128 KB |
024.txt | WA | 23 ms | 128 KB |
025.txt | WA | 6 ms | 128 KB |
026.txt | WA | 22 ms | 128 KB |
027.txt | AC | 1 ms | 128 KB |
028.txt | WA | 29 ms | 128 KB |
029.txt | WA | 2 ms | 128 KB |
030.txt | WA | 15 ms | 128 KB |
031.txt | WA | 4 ms | 128 KB |
032.txt | WA | 22 ms | 128 KB |
033.txt | AC | 13 ms | 128 KB |
034.txt | AC | 1 ms | 128 KB |
035.txt | AC | 1 ms | 128 KB |
036.txt | WA | 1 ms | 128 KB |
037.txt | AC | 1 ms | 128 KB |
038.txt | WA | 1 ms | 128 KB |
039.txt | AC | 1 ms | 128 KB |
040.txt | AC | 1 ms | 128 KB |
041.txt | AC | 1 ms | 128 KB |
042.txt | WA | 1 ms | 128 KB |
043.txt | WA | 1 ms | 128 KB |
example0.txt | AC | 1 ms | 128 KB |
example1.txt | AC | 1 ms | 128 KB |
example2.txt | AC | 1 ms | 128 KB |
example3.txt | AC | 34 ms | 128 KB |