QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#131267#5456. Big PictureHanx16MsgrWA 2ms7716kbC++14972b2023-07-26 20:00:532023-07-26 20:00:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-26 20:00:54]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:7716kb
  • [2023-07-26 20:00:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int _N = 1000 + 5, mod = 998244353;
int n, m, a[_N][_N], b[_N][_N];
int suma[_N][_N], sumb[_N][_N];
int Add(int x, int y) {
	int res = x + y;
	return res >= mod ? res - mod : res;
}
void Addmod(int &x, int y) { x = Add(x, y); }
signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)	
			cin >> a[i][j], suma[i][j] = Add(suma[i][j - 1], a[i][j]);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			cin >> b[i][j], sumb[i][j] = Add(sumb[i - 1][j], b[i][j]);
	int ans = 2;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j) {
			int res = 1ll * suma[i][j - 1] * sumb[i - 1][j] % mod;
			res = 1ll * res * Add(suma[i + 1][n], mod - suma[i + 1][j - 1]) % mod;
			res = 1ll * res * Add(sumb[n][j + 1], mod - sumb[i - 1][j + 1]) % mod;
			Addmod(ans, res);
		}
	cout << ans << '\n';
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 7584kb

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: 7536kb

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: 7492kb

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: 1ms
memory: 7716kb

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: 2ms
memory: 7584kb

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:

959955508

result:

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