QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#241505#5456. Big PictureinvisibleWA 1ms5676kbC++141.2kb2023-11-06 09:21:532023-11-06 09:21:53

Judging History

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

  • [2023-11-06 09:21:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5676kb
  • [2023-11-06 09:21:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1.1e3;
const int mod = 998244353;
int n, m, l[N][N], u[N][N], E;

signed main()
{
    ios::sync_with_stdio(0);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin >> l[i][j];
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin >> u[i][j];
    for (int i = 1; i <= n; ++i)
        for (int j = n; j >= 1; --j)
            l[i][j] = (l[i][j] + l[i][j + 1]) % mod;
    for (int j = 1; j <= n; ++j)
        for (int i = n; i >= 1; --i)
            u[i][j] = (u[i][j] + u[i + 1][j]) % mod;

    // for (int i = 1; i <= n; ++i)
    //     for (int j = 1; j <= n; ++j)
    //         printf("%d%c", l[i][j], " \n"[j == n]);

    // for (int i = 1; i <= n; ++i)
    //     for (int j = 1; j <= n; ++j)
    //         printf("%d%c", u[i][j], " \n"[j == n]);

    for (int i = 1; i < n; ++i)
        for (int j = 1; j < n; ++j)
        {
            int v1 = 1ll * (mod - l[i][j] + 1) * (mod - u[i][j] + 1) % mod;
            int v2 = 1ll * l[i + 1][j] * u[i][j + 1] % mod;
            E = (E + 1ll * v1 * v2 % mod) % mod;
        }
    cout << E + 2 << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5676kb

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

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

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

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

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:

28908688

result:

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