记录编号 |
595062 |
评测结果 |
AAAAAAAAAAAAAAAAAAAAAAAAA |
题目名称 |
[CSP 2019S]Emiya家今天的饭 |
最终得分 |
100 |
用户昵称 |
┭┮﹏┭┮ |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
1.769 s |
提交时间 |
2024-10-07 19:05:16 |
内存使用 |
4.14 MiB |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define fi first
#define in inline
#define se second
#define mp make_pair
#define pb push_back
const int N = 110,M = 2e3+10;
const ll mod = 998244353;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
int n,m;
int a[N][M];
ll f[N][N<<2],s[N];
int main(){
freopen("2019meal.in","r",stdin);
freopen("2019meal.out","w",stdout);
n = read(),m = read();
for(int i = 1;i <= n;i++)
for(int j = 1;j <= m;j++)a[i][j] = read(),(s[i] += a[i][j]) %= mod;
ll ans = 1;
for(int i = 1;i <= n;i++)ans = ans * (s[i] + 1) % mod;
ans = (ans + mod - 1) % 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 = 0;j <= 2*n;j++){
f[i][j] = f[i-1][j];
(f[i][j] += f[i-1][j+1] * (s[i] - a[i][l]) % mod) %= mod;
if(j)(f[i][j] += f[i-1][j-1] * a[i][l] % mod) %= mod;
}
for(int i = n+1;i <= 2*n;i++)ans = (ans + mod - f[n][i]) % mod;
}
printf("%lld\n",ans);
return 0;
}