Submission #50746731


Source Code Expand

// LUOGU_RID: 148915107
//Author: gsczl71
//Copyright (c) 2024 gsczl71 All rights reserved.

#include<bits/stdc++.h>
#define ll long long
#define i128 __int128
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fs first
#define sc second
#define endl '\n'
#define debug puts("AK IOI")
#define re register
#define pb push_back
#define mem(a,x) memset((a),(x),sizeof(a))
#define vi vector<int>
using namespace std;
#define int long long
// const int mod = 1e9+7;
const int mod = 998244353;
const int inf = 0x3f3f3f3f,N = 5005,M = 2e5+5;
const ll linf = 0x3f3f3f3f3f3f3f3f;
int n,m;
int dp[N][N];
void solve(){
	cin>>n>>m;
	dp[0][0]=1;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			dp[i][j] = dp[i-1][j-1];
			if(j >= (i-1)/m) dp[i][j] += (dp[i-1][j] * (j - (i-1)/m));
			dp[i][j] %= mod;
		}
	}for(int i = 1;i <= n;i++){
		cout<<dp[n][i]<<endl;
	}
}
signed main(){
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	int T=1;
//	cin >> T;
	while(T--) solve();
	return 0;
}

Submission Info

Submission Time
Task G - Groups
User Expert_Dream
Language C++ 20 (gcc 12.2)
Score 600
Code Size 1101 Byte
Status AC
Exec Time 97 ms
Memory 199068 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 27
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 39 ms 84988 KiB
random_02.txt AC 20 ms 44600 KiB
random_03.txt AC 50 ms 107832 KiB
random_04.txt AC 95 ms 196104 KiB
random_05.txt AC 86 ms 181900 KiB
random_06.txt AC 26 ms 57100 KiB
random_07.txt AC 12 ms 27876 KiB
random_08.txt AC 53 ms 111796 KiB
random_09.txt AC 71 ms 150780 KiB
random_10.txt AC 8 ms 20180 KiB
random_11.txt AC 6 ms 15128 KiB
random_12.txt AC 42 ms 90000 KiB
random_13.txt AC 1 ms 3360 KiB
random_14.txt AC 1 ms 3448 KiB
random_15.txt AC 1 ms 3524 KiB
random_16.txt AC 29 ms 62584 KiB
random_17.txt AC 28 ms 62440 KiB
random_18.txt AC 28 ms 62664 KiB
random_19.txt AC 96 ms 198996 KiB
random_20.txt AC 97 ms 198988 KiB
random_21.txt AC 97 ms 198932 KiB
random_22.txt AC 96 ms 199068 KiB
random_23.txt AC 97 ms 198992 KiB
random_24.txt AC 97 ms 198944 KiB
sample_01.txt AC 1 ms 3568 KiB
sample_02.txt AC 1 ms 3536 KiB
sample_03.txt AC 1 ms 3492 KiB