提出 #34180093
ソースコード 拡げる
#include<bits/stdc++.h>
#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#define DD(...) D(#__VA_ARGS__ "="),debug_helper::debug(__VA_ARGS__),D("\n")
#include"/home/xay5421/debug.hpp"
#else
#define D(...) ((void)0)
#define DD(...) ((void)0)
#endif
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define each(x,v) for(auto&x:v)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
template<class T>void rd(T&x){int f=0,c;while(!isdigit(c=getchar()))f^=!(c^45);x=(c&15);while(isdigit(c=getchar()))x=x*10+(c&15);if(f)x=-x;}
template<class T>void pt(T x,int c=-1){if(x<0)putchar('-'),x=-x;if(x>9)pt(x/10);putchar(x%10+48);if(c!=-1)putchar(c);}
using namespace std;
using LL=long long;
using ULL=unsigned long long;
const int P=998244353;
int ad(int k1,int k2){return k1+k2>=P?k1+k2-P:k1+k2;}
int su(int k1,int k2){return k1-k2<0?k1-k2+P:k1-k2;}
int mu(int k1,int k2){return 1ULL*k1*k2%P;}
void uad(int&k1,int k2){(k1+=k2)>=P&&(k1-=P);}
void usu(int&k1,int k2){(k1-=k2)<0&&(k1+=P);}
template<class... T>int ad(int k1,T... k2){return ad(k1,ad(k2...));}
template<class... T>int su(int k1,T... k2){return su(k1,ad(k2...));}
template<class... T>int mu(int k1,T... k2){return mu(k1,mu(k2...));}
template<class... T>void uad(int&k1,T... k2){return uad(k1,ad(k2...));}
template<class... T>void usu(int&k1,T... k2){return usu(k1,ad(k2...));}
int po(int k1,int k2){
int k3=1;
for(;k2;k2>>=1,k1=mu(k1,k1))if(k2&1)k3=mu(k3,k1);
return k3;
}
const int N=200005;
int n,m,f[N][2],g[N][2];
int main(){
rd(n),rd(m);
f[1][1]=1; // 1 是上升
rep(i,2,n*2-1){
rep(j,0,m)g[j][0]=g[j][1]=0;
rep(j,0,m){
if(j+1<=m){
uad(g[j+1][1],mu(f[j][0],j));
uad(g[j+1][1],mu(f[j][1],j));
}
if(j){
uad(g[j-1][0],mu(f[j][0],j));
uad(g[j-1][0],f[j][1]);
}
}
rep(j,0,m)f[j][0]=g[j][0],f[j][1]=g[j][1];
}
printf("%d\n",f[1][0]);
return 0;
}
提出情報
提出日時 |
|
問題 |
F - Simple Solitaire |
ユーザ |
xay5421 |
言語 |
C++ (GCC 9.2.1) |
得点 |
0 |
コード長 |
1975 Byte |
結果 |
TLE |
実行時間 |
11025 ms |
メモリ |
6344 KiB |
ジャッジ結果
セット名 |
Sample |
All |
得点 / 配点 |
0 / 0 |
0 / 1200 |
結果 |
|
|
セット名 |
テストケース |
Sample |
example_00.txt, example_01.txt, example_02.txt |
All |
example_00.txt, example_01.txt, example_02.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt |
ケース名 |
結果 |
実行時間 |
メモリ |
example_00.txt |
AC |
6 ms |
3504 KiB |
example_01.txt |
AC |
3 ms |
3656 KiB |
example_02.txt |
AC |
248 ms |
3612 KiB |
test_00.txt |
TLE |
11025 ms |
3600 KiB |
test_01.txt |
AC |
2121 ms |
3808 KiB |
test_02.txt |
AC |
2298 ms |
3524 KiB |
test_03.txt |
TLE |
11025 ms |
3892 KiB |
test_04.txt |
AC |
484 ms |
3600 KiB |
test_05.txt |
TLE |
11025 ms |
4720 KiB |
test_06.txt |
TLE |
11025 ms |
3992 KiB |
test_07.txt |
TLE |
11025 ms |
5584 KiB |
test_08.txt |
TLE |
11025 ms |
5000 KiB |
test_09.txt |
TLE |
11025 ms |
5664 KiB |
test_10.txt |
AC |
12 ms |
3508 KiB |
test_11.txt |
AC |
15 ms |
3524 KiB |
test_12.txt |
AC |
11 ms |
3508 KiB |
test_13.txt |
AC |
2 ms |
3628 KiB |
test_14.txt |
TLE |
11025 ms |
6300 KiB |
test_15.txt |
TLE |
11025 ms |
6168 KiB |
test_16.txt |
TLE |
11025 ms |
6344 KiB |
test_17.txt |
TLE |
11025 ms |
6300 KiB |
test_18.txt |
TLE |
11025 ms |
6304 KiB |
test_19.txt |
TLE |
11025 ms |
6296 KiB |
test_20.txt |
TLE |
11025 ms |
6252 KiB |
test_21.txt |
TLE |
11025 ms |
6304 KiB |
test_22.txt |
TLE |
11025 ms |
6180 KiB |
test_23.txt |
TLE |
11025 ms |
6180 KiB |