結果

問題 No.1388 Less than K
ユーザー 👑 kmjpkmjp
提出日時 2021-02-11 12:01:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,625 bytes
コンパイル時間 1,996 ms
コンパイル使用メモリ 199,788 KB
実行使用メモリ 12,972 KB
最終ジャッジ日時 2023-09-25 01:00:53
合計ジャッジ時間 14,514 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
12,972 KB
testcase_01 AC 19 ms
12,696 KB
testcase_02 AC 20 ms
12,868 KB
testcase_03 AC 19 ms
12,744 KB
testcase_04 AC 20 ms
12,736 KB
testcase_05 AC 20 ms
12,792 KB
testcase_06 AC 20 ms
12,680 KB
testcase_07 RE -
testcase_08 AC 22 ms
12,748 KB
testcase_09 AC 20 ms
12,744 KB
testcase_10 AC 20 ms
12,956 KB
testcase_11 AC 20 ms
12,692 KB
testcase_12 AC 22 ms
12,828 KB
testcase_13 AC 23 ms
12,812 KB
testcase_14 AC 26 ms
12,796 KB
testcase_15 AC 37 ms
12,972 KB
testcase_16 AC 47 ms
12,732 KB
testcase_17 AC 63 ms
12,768 KB
testcase_18 AC 94 ms
12,688 KB
testcase_19 AC 127 ms
12,732 KB
testcase_20 AC 137 ms
12,736 KB
testcase_21 AC 26 ms
12,896 KB
testcase_22 RE -
testcase_23 AC 20 ms
12,864 KB
testcase_24 AC 22 ms
12,816 KB
testcase_25 AC 22 ms
12,808 KB
testcase_26 AC 20 ms
12,748 KB
testcase_27 AC 20 ms
12,808 KB
testcase_28 AC 20 ms
12,748 KB
testcase_29 AC 19 ms
12,688 KB
testcase_30 AC 19 ms
12,684 KB
testcase_31 AC 19 ms
12,680 KB
testcase_32 AC 19 ms
12,744 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 29 ms
12,748 KB
testcase_39 AC 23 ms
12,744 KB
testcase_40 AC 26 ms
12,696 KB
testcase_41 AC 41 ms
12,756 KB
testcase_42 AC 23 ms
12,740 KB
testcase_43 RE -
testcase_44 AC 200 ms
12,740 KB
testcase_45 AC 353 ms
12,680 KB
testcase_46 AC 298 ms
12,736 KB
testcase_47 AC 253 ms
12,696 KB
testcase_48 AC 219 ms
12,748 KB
testcase_49 AC 269 ms
12,752 KB
testcase_50 AC 254 ms
12,864 KB
testcase_51 AC 361 ms
12,764 KB
testcase_52 AC 433 ms
12,760 KB
testcase_53 AC 43 ms
12,796 KB
testcase_54 AC 35 ms
12,684 KB
testcase_55 AC 23 ms
12,768 KB
testcase_56 AC 66 ms
12,924 KB
testcase_57 AC 153 ms
12,748 KB
testcase_58 AC 258 ms
12,688 KB
testcase_59 AC 363 ms
12,692 KB
testcase_60 AC 447 ms
12,688 KB
testcase_61 RE -
testcase_62 RE -
testcase_63 AC 25 ms
12,896 KB
testcase_64 AC 27 ms
12,752 KB
testcase_65 AC 36 ms
12,764 KB
testcase_66 AC 43 ms
12,752 KB
testcase_67 AC 46 ms
12,864 KB
testcase_68 AC 111 ms
12,768 KB
testcase_69 AC 131 ms
12,752 KB
testcase_70 AC 194 ms
12,760 KB
testcase_71 AC 301 ms
12,744 KB
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

const ll mo=998244353;

ll comb(ll N_, ll C_) {
	const int NUM_=400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

int H,W,K;
ll from[505],to[505];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>K;
	H--,W--;
	K/=2;
	ll ret=0;
	if(K<=500) {
		from[0]=1;
		for(x=0;x<=min(H,W);x++) {
			ll other=comb(H+W,H-x)*comb(W+x,W-x)%mo;
			(ret+=other*from[0])%=mo;
			FOR(i,K+1) to[i]=(from[abs(i-1)]+from[abs(i+1)])%mo;
			FOR(i,K+1) from[i]=(to[abs(i-1)]+to[abs(i+1)])%mo;
		}
	}
	else {
		assert(0);
	}
	
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0