QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#448043#5456. Big Pictureship2077AC ✓61ms13204kbC++17754b2024-06-19 10:00:542024-06-19 10:00:54

Judging History

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

  • [2024-06-19 10:00:54]
  • 评测
  • 测评结果:AC
  • 用时:61ms
  • 内存:13204kb
  • [2024-06-19 10:00:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=1005,mod=998244353;
int n,m,ans,r[M][M],c[M][M],sumr[M][M],sumc[M][M];
int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x;
}
int rdc(int x){return x>=mod?x-mod:x;}
int main(){
    n=read();m=read();ans=2;
    for (int i=1;i<=n;i++) for (int j=1;j<=m;j++)
        sumr[i][j]=rdc(sumr[i][j-1]+read());
    for (int i=1;i<=n;i++) for (int j=1;j<=m;j++)
        sumc[i][j]=rdc(sumc[i-1][j]+read());
    for (int i=2;i<n;i++) for (int j=2;j<m;j++)
        ans=(ans+1ll*(mod+1-sumr[i+1][j-1])*(mod+1-sumc[i-1][j+1])%mod*sumr[i][j-1]%mod*sumc[i-1][j])%mod;
    printf("%d\n",ans);
    return 0;
}

详细

Test #1:

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

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

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

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: 0
Accepted
time: 0ms
memory: 3804kb

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:

784737880

result:

ok 1 number(s): "784737880"

Test #6:

score: 0
Accepted
time: 1ms
memory: 6500kb

input:

100 100
968816278 734173596 234681910 93630748 134697884 471229964 39013156 956757252 235131257 511081728 621947839 676193272 840439535 664182871 902176048 20092424 884007838 81431694 951304691 976244158 965161864 845777280 94028804 565315467 686041993 462628490 127799346 373093423 391855425 4867259...

output:

674065285

result:

ok 1 number(s): "674065285"

Test #7:

score: 0
Accepted
time: 3ms
memory: 5336kb

input:

200 199
651700501 316888933 636760258 710519804 979635790 431517212 426271520 438606170 264014396 821432690 856532353 593193153 730369769 738218364 931314610 464183384 649108501 692856317 896419090 859042084 253545651 925218904 209204714 964720847 270465040 877213966 556600916 266109538 89025348 955...

output:

761582714

result:

ok 1 number(s): "761582714"

Test #8:

score: 0
Accepted
time: 3ms
memory: 6904kb

input:

199 200
855982177 899033137 857166748 154194180 491821489 936038701 3224246 36250618 98892048 302140015 794640536 416783706 127675016 405917998 810549418 512853897 794410341 751776756 962776697 437808995 42664926 617079413 287993531 754517649 196857387 98605924 437576034 405249986 501341390 9381807 ...

output:

23575883

result:

ok 1 number(s): "23575883"

Test #9:

score: 0
Accepted
time: 8ms
memory: 7868kb

input:

500 400
72515769 740084226 495955960 818627803 996233188 939336757 660769842 900083013 516811832 948688370 190983166 700755046 725666191 328442680 875581535 336718725 61207501 432805968 739541236 154531312 562430186 291869705 53196304 388792842 771217822 494695449 92141944 786309802 59729318 8289686...

output:

646310271

result:

ok 1 number(s): "646310271"

Test #10:

score: 0
Accepted
time: 45ms
memory: 13020kb

input:

1000 999
795650098 214468232 293238302 956472869 963508300 152950675 332778044 343814027 226283602 475129464 264926647 612915811 52220688 752047365 53207005 824854089 964440017 176446166 421148215 794524271 734053120 903086814 195743674 134468212 708339297 274493474 991647876 223649647 499895016 343...

output:

777267719

result:

ok 1 number(s): "777267719"

Test #11:

score: 0
Accepted
time: 61ms
memory: 13204kb

input:

999 1000
990078941 834513847 566770109 186987188 311749761 202816623 18178171 341799789 882531908 227919120 738756186 31713847 38448010 887427104 749097109 721772777 800574980 140838641 340760447 317536000 153645022 20203677 509441381 92386232 683428380 485171900 141082579 519803036 239407921 431904...

output:

797495799

result:

ok 1 number(s): "797495799"

Test #12:

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

input:

1 1000
865561477 72336177 512589404 659280480 729664705 332496264 10125067 162396209 337852118 235168352 745897162 624343408 680571458 406843703 593295102 463447303 875777949 65980904 986994648 123891087 299721718 487984705 833593382 879673048 20178491 596839074 66333708 72629381 989328440 610923886...

output:

2

result:

ok 1 number(s): "2"

Test #13:

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

input:

1000 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

2

result:

ok 1 number(s): "2"

Test #14:

score: 0
Accepted
time: 49ms
memory: 12288kb

input:

1000 1000
363404459 364033656 109262550 987419044 566850510 158677668 86765910 117668850 972431056 752990746 797824608 368896025 828777722 179827000 547989067 559543021 250055475 621118166 343014414 973968011 780219307 411784822 657282180 275541216 632340286 805660555 962920542 536482883 840886893 2...

output:

319243592

result:

ok 1 number(s): "319243592"