QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#712004#5456. Big Picture123456zmyWA 0ms4112kbC++17668b2024-11-05 14:15:492024-11-05 14:15:50

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 14:15:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4112kb
  • [2024-11-05 14:15:49]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define mod 998244353
using namespace std;
signed main()
{
	int n,m,ans=2;
	scanf("%lld%lld",&n,&m);
	vector<vector<int>>p(n+2,vector<int>(m+2));
	vector<vector<int>>q(n+2,vector<int>(m+2));
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)scanf("%lld",&p[i][j]);
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)scanf("%lld",&q[i][j]);
	for(int i=1;i<=n;i++)for(int j=1;j<m;j++)p[i][j]+=p[i][j+1];
	for(int i=1;i<n;i++)for(int j=1;j<=m;j++)q[i][j]+=q[i+1][j];
	for(int i=2;i<=n;i++)for(int j=2;j<=m;j++)
		ans+=p[i+1][j]*q[i][j+1]%mod*(mod+1-p[i][j])%mod*(mod+1-q[i][j])%mod;
	printf("%lld\n",ans%mod);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4112kb

input:

3 3
0 0 1
1 0 0
0 0 1
0 1 0
0 0 0
1 0 1

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 0ms
memory: 4080kb

input:

2 2
499122177 499122177
499122177 499122177
499122177 499122177
499122177 499122177

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

3 3
332748118 332748118 332748118
332748118 332748118 332748118
332748118 332748118 332748118
332748118 332748118 332748118
332748118 332748118 332748118
332748118 332748118 332748118

output:

308100111

result:

ok 1 number(s): "308100111"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

3 3
493467174 925495668 577525865
405223176 658993746 932271785
966780207 630353698 399354802
22358767 981331599 114314620
272795749 519599007 591379230
703089838 495558101 292550504

output:

23563191

result:

ok 1 number(s): "23563191"

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3796kb

input:

3 4
493659548 347753380 41129357 115702069
790219615 554402002 99659402 552207688
7961216 627013784 223799162 139470192
329148825 491071064 379664791 105141924
498265681 675980390 393090456 957492234
170829848 829437253 225489107 933854549

output:

672198037

result:

wrong answer 1st numbers differ - expected: '784737880', found: '672198037'