Submission #1843275
Source Code Expand
#include <cstdio> const int mo=924844033; int f[4005][2005][2]; bool u[4005]; int main(){ int n,k; scanf("%d%d\n",&n,&k); int x=(n-1)/k+1,y=0; for (int i=((n-1)%k+1)*2;i;i--) u[y+=x]=1; for (;y<2*n;) u[y+=x-1]=1; f[0][0][1]=1; for (int i=1;i<=2*n;i++) for (int j=0;j<=n;j++){ f[i][j][0]=f[i][j][1]=f[i-1][j][1]; if (!u[i-1] && j) (f[i][j][1]+=f[i-1][j-1][0])%=mo; } int ans=0; for (int i=0,j=(n&1)?-1:1,k=1;i<=n;j=-j,k=1ll*k*++i%mo) ans=(ans+1ll*f[2*n][n-i][1]*k*j)%mo; printf("%d\n",(ans+mo)%mo); }
Submission Info
Submission Time | |
---|---|
Task | D - ~K Perm Counting |
User | aufeas |
Language | C++14 (GCC 5.4.1) |
Score | 900 |
Code Size | 541 Byte |
Status | AC |
Exec Time | 34 ms |
Memory | 62848 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:7:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d\n",&n,&k); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 900 / 900 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2, example3, example4 |
All | example0, example1, example2, example3, example4, handmade0, handmade1, handmade2, handmade3, handmade4, handmade5, handmade6, maxrand0, maxrand1, maxrand2, maxrand3, maxrand4, rand0, rand1, rand2, rand3, rand4, small0, small1, small2, supersmall0, supersmall1, supersmall2 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example0 | AC | 1 ms | 128 KB |
example1 | AC | 1 ms | 128 KB |
example2 | AC | 1 ms | 256 KB |
example3 | AC | 1 ms | 256 KB |
example4 | AC | 4 ms | 13440 KB |
handmade0 | AC | 1 ms | 128 KB |
handmade1 | AC | 34 ms | 62848 KB |
handmade2 | AC | 22 ms | 62848 KB |
handmade3 | AC | 31 ms | 59520 KB |
handmade4 | AC | 20 ms | 59520 KB |
handmade5 | AC | 34 ms | 62848 KB |
handmade6 | AC | 34 ms | 62848 KB |
maxrand0 | AC | 23 ms | 61568 KB |
maxrand1 | AC | 27 ms | 61568 KB |
maxrand2 | AC | 28 ms | 61696 KB |
maxrand3 | AC | 32 ms | 61568 KB |
maxrand4 | AC | 21 ms | 61568 KB |
rand0 | AC | 31 ms | 62592 KB |
rand1 | AC | 6 ms | 19712 KB |
rand2 | AC | 6 ms | 21888 KB |
rand3 | AC | 1 ms | 2816 KB |
rand4 | AC | 21 ms | 57472 KB |
small0 | AC | 3 ms | 9216 KB |
small1 | AC | 2 ms | 4992 KB |
small2 | AC | 2 ms | 7040 KB |
supersmall0 | AC | 1 ms | 128 KB |
supersmall1 | AC | 1 ms | 128 KB |
supersmall2 | AC | 1 ms | 128 KB |