比赛 |
EYOI常规赛 4th |
评测结果 |
AAAAAAAAAAAAAAAATTTTTTTTT |
题目名称 |
Emiya家今天的饭 |
最终得分 |
64 |
用户昵称 |
冷月星云 |
运行时间 |
9.582 s |
代码语言 |
C++ |
内存使用 |
99.27 MiB |
提交时间 |
2022-05-29 09:05:03 |
显示代码纯文本
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
using namespace std;
ll a[105][2005];
ll s[105],f[2005][4005],g[2005][2005],ans;
const ll MOD = 998244353;
int main()
{
freopen("2019meal.in","r",stdin);
freopen("2019meal.out","w",stdout);
ll n,m;
cin >> n >> m;
for(int i = 1;i <= n;i++)
for(int j = 1;j <= m;j++)
{
cin >> a[i][j];
s[i] = (s[i] + a[i][j]) % MOD;
}
g[0][0] = 1;
for(int i = 1;i <= n;i++)
for(int j = 0;j <= n;j++)
g[i][j] = (g[i - 1][j] + s[i] * g[i - 1][j - 1] % MOD) % MOD;
for(int i = 1;i <= n;i++)
ans = (ans + g[n][i]) % MOD;
for(int l = 1;l <= m;l++){
memset(f,0,sizeof(f));
f[0][n] = 1;
for(int i = 1;i <= n;i++)
for(int j = n - i;j <= n + i;j++)
f[i][j] = (f[i-1][j] + a[i][l] * f[i - 1][j - 1] % MOD + (s[i] - a[i][l]) * f[i - 1][j + 1] % MOD) % MOD;
for(int i = 1;i <= n;i++)
ans = (ans - f[n][n+i] + MOD) % MOD;
}
cout << ans;
return 0;
}