QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#131213 | #5456. Big Picture | starrylasky | WA | 1ms | 7764kb | C++14 | 1.4kb | 2023-07-26 18:36:29 | 2023-07-26 18:36:32 |
Judging History
answer
///yl/hs/bx/yl
#include<bits/stdc++.h>
#define fep(i,l,r) for(int i=l;i<=r;++i)
#define feb(i,r,l) for(int i=r;i>=l;--i)
#define For(i,u) for(int i=head[u];i;i=e[i].nxt)
#define LL long long
// #define int long long
#define ld long double
#define pr pair<int,int>
#define mpr make_pair
using namespace std;
const int N = 2e3+5,mod = 998244353;
inline int read()
{
int s=0,w=1; char ch=getchar();
while(!(ch>='0'&&ch<='9')) {if(ch=='-') w=-1; ch=getchar();}
while( ch>='0'&&ch<='9') {s=(s<<1)+(s<<3)+ch-'0'; ch=getchar();}
return s*w;
}
inline int Mod(int x) {return x>=mod?x-mod:x;}
inline void addmod(int &x,int y) {x=Mod(x+y);}
namespace starrylasky
{
int n,m,a[N][N],b[N][N],sa[N][N],sb[N][N];
inline void Main()
{
n=read(),m=read(); int ans=2;
fep(i,1,n) fep(j,1,m) a[i][j]=read();
fep(i,1,m) fep(j,1,n) b[i][j]=read();
fep(i,1,n) fep(j,1,m)
sa[i][j]=Mod(sa[i][j-1]+a[i][j]);
fep(i,1,m) fep(j,1,n)
sb[i][j]=Mod(sb[i][j-1]+b[i][j]);
fep(i,1,n) fep(j,1,m)
{
int res1=sa[i+1][m]-sa[i+1][j-1];
int res2=sb[j+1][n]-sb[j+1][i-1];
int res3=sa[i][j-1];
int res4=sb[j][i-1];
addmod(ans,1ll*res1*res2%mod*res3%mod*res4%mod);
}
printf("%d\n",ans);
}
}
signed main()
{
int _T=1;
while(_T--) starrylasky::Main();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 7764kb
input:
3 3 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'