結果

問題 No.2807 Have Another Go (Easy)
ユーザー cho435cho435
提出日時 2024-07-13 02:29:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 3,000 ms
コード長 997 bytes
コンパイル時間 4,959 ms
コンパイル使用メモリ 265,592 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-07-13 02:29:40
合計ジャッジ時間 7,259 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 13 ms
6,956 KB
testcase_02 AC 10 ms
5,760 KB
testcase_03 AC 9 ms
5,248 KB
testcase_04 AC 7 ms
5,376 KB
testcase_05 AC 12 ms
6,144 KB
testcase_06 AC 12 ms
6,144 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 8 ms
5,376 KB
testcase_11 AC 15 ms
7,296 KB
testcase_12 AC 16 ms
7,168 KB
testcase_13 AC 15 ms
7,228 KB
testcase_14 AC 16 ms
7,124 KB
testcase_15 AC 16 ms
7,168 KB
testcase_16 AC 15 ms
7,144 KB
testcase_17 AC 14 ms
7,168 KB
testcase_18 AC 16 ms
7,156 KB
testcase_19 AC 15 ms
7,168 KB
testcase_20 AC 15 ms
7,124 KB
testcase_21 AC 16 ms
7,168 KB
testcase_22 AC 16 ms
7,168 KB
testcase_23 AC 15 ms
7,284 KB
testcase_24 AC 15 ms
7,296 KB
testcase_25 AC 16 ms
7,168 KB
testcase_26 AC 15 ms
7,296 KB
testcase_27 AC 16 ms
7,168 KB
testcase_28 AC 15 ms
7,144 KB
testcase_29 AC 15 ms
7,168 KB
testcase_30 AC 17 ms
7,264 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 3 ms
5,376 KB
testcase_41 AC 3 ms
5,376 KB
testcase_42 AC 3 ms
5,376 KB
testcase_43 AC 3 ms
5,376 KB
testcase_44 AC 3 ms
5,376 KB
testcase_45 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)

template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }

struct io_setup {
	io_setup() {
		ios::sync_with_stdio(false);
		std::cin.tie(nullptr);
		cout << fixed << setprecision(15);
	}
} io_setup;

using mint = atcoder::modint998244353;

int main(){
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll> c(k);
	rep(i,0,k) cin>>c.at(i);
	vector<mint> dp(n*m+1,0);
	dp.at(0)=1;
	rep(i,0,n*m){
		for(int j=1;j<=6;j++){
			dp.at(min(i+j,n*m))+=dp.at(i);
		}
	}
	rep(i,0,k){
		mint ans=0;
		rep(j,0,6){
			if(n*2-c.at(i)-1-j>=0) ans+=dp.at(c.at(i))*dp.at(n*2-c.at(i)-1-j)*(6-j);
			if(n-c.at(i)-1-j>=0){
				ans+=dp.at(c.at(i)+n)*dp.at(n-c.at(i)-1-j)*(6-j);
				ans-=dp.at(c.at(i))*dp.at(n)*dp.at(n-c.at(i)-1-j)*(6-j);
			}
		}
		cout<<ans.val()<<"\n";
	}
}
0