Submission #3272353
Source Code Expand
#include<bits/stdc++.h>
#define reg register
#define F(i,j,k) for(reg int i=(j);i<=(k);++i)
#define dF(i,j,k) for(reg int i=(j);i>=(k);--i)
using namespace std;
typedef long long ll;
int n,k;
const int mod=998244353;
const int MN=2005;
int C[MN<<1][MN<<1],pw[MN<<1];
inline ll add(ll a,ll b){a+=b;return a-(a>=mod?mod:0);}
inline ll solve(int i,int tot){
reg int k2=min(k-i/2,(i-1)/2);reg int k1=k-(k2<<1)-((i&1)==0);
reg ll res=0,pos=1;
for(reg int j=k2;j+k1>0&&j>=0;j--,pos*=-1)
res=add(res,pos*C[j+k1+tot-1][j+k1-1]%mod*pw[j]%mod*C[k2][j]%mod);
return add(res,mod);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>k>>n;C[0][0]=1;pw[0]=1;
F(i,1,n<<1){
C[i][0]=1;pw[i]=add(pw[i-1],pw[i-1]);F(j,1,i)C[i][j]=add(C[i-1][j-1],C[i-1][j]);
}
reg ll ans=0;
F(i,2,k<<1){
if(~i&1)ans=add(solve(i,n),solve(i,n-1));
else ans=solve(i,n);
cout<<ans<<endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
E - Stop. Otherwise... |
User |
vjudge1 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
904 Byte |
Status |
WA |
Exec Time |
58 ms |
Memory |
61568 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 700 |
Status |
|
|
Set Name |
Test Cases |
Sample |
s1.txt, s2.txt, s3.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt, s3.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
WA |
58 ms |
61568 KB |
02.txt |
WA |
51 ms |
61056 KB |
03.txt |
WA |
45 ms |
35712 KB |
04.txt |
AC |
24 ms |
61440 KB |
05.txt |
WA |
35 ms |
256 KB |
06.txt |
WA |
45 ms |
50048 KB |
07.txt |
WA |
58 ms |
61440 KB |
08.txt |
WA |
25 ms |
54144 KB |
09.txt |
AC |
13 ms |
37632 KB |
10.txt |
WA |
20 ms |
384 KB |
11.txt |
WA |
32 ms |
256 KB |
12.txt |
AC |
18 ms |
51968 KB |
13.txt |
WA |
8 ms |
8960 KB |
14.txt |
WA |
43 ms |
39808 KB |
15.txt |
WA |
48 ms |
50048 KB |
16.txt |
WA |
47 ms |
56192 KB |
17.txt |
AC |
1 ms |
256 KB |
18.txt |
AC |
1 ms |
256 KB |
19.txt |
AC |
1 ms |
256 KB |
20.txt |
AC |
1 ms |
256 KB |
s1.txt |
AC |
1 ms |
256 KB |
s2.txt |
AC |
1 ms |
256 KB |
s3.txt |
AC |
10 ms |
31488 KB |