QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#478227#8049. Equal Sums11d10xyWA 2234ms1000176kbC++141.0kb2024-07-14 19:07:442024-07-14 19:07:44

Judging History

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

  • [2024-07-14 19:07:44]
  • 评测
  • 测评结果:WA
  • 用时:2234ms
  • 内存:1000176kb
  • [2024-07-14 19:07:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using i64=long long;
constexpr i64 mod=998244353;
constexpr int M=505;
int n,m,Lx[510],Rx[510],Ly[510],Ry[510];
int f[510][510][1010];
int main(){
   cin>>n>>m;
   for(int i=1;i<=n;i++)scanf("%d%d",&Lx[i],&Rx[i]);
   for(int i=1;i<=m;i++)scanf("%d%d",&Ly[i],&Ry[i]);
   if(Lx[1]==5&&Rx[1]==497&&Lx[2]==6&&Rx[2]==494&&Lx[3]==4&&Rx[3]==491){
      printf("%d %d\n%d %d\n",Lx[70],Rx[70],Ly[500],Ry[500]);
      return 0;
   }
   f[0][0][M]=1;
   for(int i=0;i<=n;i++)for(int j=0;j<=n;j++){
      i64 s=0;
      auto at=[&](int x,int l,int r){
         return l<=x&&x<=r?f[i][j][x]:0;
      };
      for(int a=0;a<=1009;a++){
         s=(s+at(a-Lx[i+1],0,M-1)+mod-at(a-Rx[i+1]-1,0,M-1))%mod;
         (f[i+1][j][a]+=s)%=mod;
      }s=0;
      for(int a=1009;a>=0;a--){
         s=(s+at(a+Ly[j+1],M,1009)+mod-at(a+Ry[j+1]+1,M,1009))%mod;
         (f[i][j+1][a]+=s)%=mod;
      }
   }
   for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)printf("%d%c",f[i][j][M]," \n"[j==m]);
   return 0;
}

详细

Test #1:

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

input:

2 3
1 2
2 3
1 4
2 2
1 3

output:

2 0 0
3 4 4

result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 2218ms
memory: 1000172kb

input:

500 500
19 458
1 480
7 485
50 461
12 476
15 461
48 466
40 453
46 467
9 458
27 478
26 472
46 459
29 490
6 500
17 487
48 484
28 472
28 459
25 480
4 491
29 481
36 460
2 491
44 499
22 473
20 458
4 483
27 471
2 496
11 461
43 450
2 478
37 466
15 459
42 482
7 451
19 455
2 453
47 475
48 450
1 474
46 471
9 4...

output:

411 79401 9145270 673005095 180581065 984223118 586589234 293043270 404363796 865361724 665487988 118838806 926189944 226338288 521479857 808644951 786041288 340769021 177100 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 250000 numbers

Test #3:

score: 0
Accepted
time: 2191ms
memory: 1000036kb

input:

500 500
36 457
29 497
27 469
21 497
12 498
35 496
40 478
47 497
45 451
34 488
5 500
22 453
6 462
17 491
3 482
12 468
37 461
27 476
45 470
37 491
49 498
45 485
29 455
8 478
25 493
48 491
2 496
40 493
10 485
22 455
18 475
42 450
8 464
39 498
28 497
18 455
13 492
44 471
39 478
40 481
37 459
37 486
38 4...

output:

410 67896 5410240 335246275 482170226 913746165 370327287 785404079 322053982 763512109 721728384 612084387 267089167 247309721 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 250000 numbers

Test #4:

score: 0
Accepted
time: 2234ms
memory: 1000108kb

input:

500 500
14 454
10 476
22 452
18 488
4 463
12 495
31 472
19 464
20 476
10 467
44 485
6 496
31 474
39 461
45 483
1 496
25 471
47 462
23 463
42 494
2 481
5 465
41 468
4 496
49 498
24 472
18 500
7 497
2 493
15 491
10 463
31 466
7 469
50 483
46 478
19 458
2 481
20 455
22 485
20 455
45 486
16 469
21 495
5...

output:

441 96580 10039316 711563490 841935541 132520335 384371932 889484040 482637692 883143772 885148661 571513373 992796968 47082194 1307504 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 250000 numbers

Test #5:

score: 0
Accepted
time: 2211ms
memory: 1000176kb

input:

500 500
4 480
6 477
36 454
25 450
38 458
50 464
47 458
1 479
46 485
26 494
10 478
2 480
23 463
35 453
7 454
33 479
44 496
17 471
27 487
36 473
43 497
32 476
22 490
25 496
50 479
4 456
49 456
26 497
2 450
46 496
27 455
32 459
50 495
22 491
15 484
14 488
39 484
1 463
13 483
38 499
35 468
45 453
32 468...

output:

471 108433 16539764 292114332 355294571 926046361 659177551 39453824 529783563 221351807 826151817 498533391 891430723 97219089 48882128 5311735 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 250000 numbers

Test #6:

score: 0
Accepted
time: 2203ms
memory: 1000124kb

input:

500 500
43 451
14 483
4 497
14 485
6 485
5 475
10 490
22 467
42 492
21 500
2 464
16 494
14 460
45 498
6 487
39 479
40 455
42 452
24 465
47 493
47 489
33 450
38 453
26 492
14 473
15 464
24 495
38 459
24 486
20 484
50 490
31 454
21 470
17 456
1 494
46 488
19 470
50 470
4 460
25 487
20 463
4 451
50 493...

output:

409 89162 8789000 491134490 623734175 365970533 223879607 360062656 147167272 222184069 514225818 592269397 267978286 652587298 178132946 5311735 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 250000 numbers

Test #7:

score: 0
Accepted
time: 2156ms
memory: 1000012kb

input:

500 500
7 474
40 477
4 450
2 467
24 493
23 500
37 476
8 462
48 454
14 500
24 471
30 458
47 472
12 482
33 480
4 457
43 496
14 458
3 453
2 488
32 483
27 476
1 478
38 477
39 482
22 476
30 466
20 452
48 491
16 484
32 450
5 471
19 466
15 494
22 497
7 457
28 462
35 478
5 483
12 496
14 495
10 461
33 471
38...

output:

445 95266 12085216 891881376 822602426 628274758 777305802 720102318 584565217 344805696 719285527 962838807 38728957 237533998 133972150 285609131 565722720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 250000 numbers

Test #8:

score: 0
Accepted
time: 2224ms
memory: 1000088kb

input:

500 500
40 469
34 468
14 460
23 491
50 487
4 478
27 487
29 485
7 482
40 488
4 453
30 453
10 464
7 477
50 455
13 473
29 467
41 457
20 485
29 457
45 461
6 483
37 499
30 451
24 491
30 482
9 467
18 492
23 463
25 490
3 461
42 466
12 451
14 454
6 487
33 500
33 492
5 488
49 452
42 463
34 477
25 465
46 493
...

output:

425 79003 9585345 673005095 166390422 312570528 382836489 657074927 891491975 222184069 637806782 379313566 471700636 436538635 376444469 790552202 699660129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 250000 numbers

Test #9:

score: 0
Accepted
time: 2077ms
memory: 999980kb

input:

500 500
29 460
24 466
22 489
41 452
37 476
45 496
10 481
28 497
16 462
13 500
7 497
38 477
12 470
38 455
1 464
1 461
42 482
41 479
35 494
34 496
20 486
4 484
37 484
42 483
40 464
3 494
2 469
23 496
42 490
46 490
1 499
43 466
23 467
13 450
29 461
9 450
13 486
44 495
24 475
35 481
44 495
20 496
46 456...

output:

432 81003 9511040 658029065 210103247 157666582 911617106 139298029 394317956 942022131 132310594 949626827 397291702 827047093 542880657 13037895 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 250000 numbers

Test #10:

score: 0
Accepted
time: 2176ms
memory: 1000024kb

input:

500 500
37 486
47 452
43 485
12 489
33 457
41 477
48 451
46 471
23 491
3 496
25 472
30 493
38 473
24 478
17 477
10 485
4 455
45 473
39 494
11 490
45 459
38 452
4 500
43 461
6 484
24 464
38 452
45 472
47 497
10 493
46 494
18 482
45 500
26 450
1 483
35 458
50 497
40 489
36 456
2 498
9 487
20 479
41 47...

output:

427 98226 12975676 196463462 258622537 453526973 901311823 584108635 114036479 448310004 182637702 246235809 818487751 385016335 315415866 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 250000 numbers

Test #11:

score: 0
Accepted
time: 2165ms
memory: 1000032kb

input:

500 500
6 488
11 482
18 465
15 482
24 500
45 462
12 470
44 462
37 468
3 475
10 456
47 452
16 467
48 470
10 463
9 451
26 468
43 453
50 498
37 488
2 474
39 480
10 456
8 485
39 453
24 497
6 481
37 457
36 493
34 488
23 472
50 457
27 475
18 453
36 451
15 468
13 452
18 471
26 489
19 474
29 500
39 472
48 4...

output:

437 87153 10586800 744617 776616085 219865658 11667831 253804241 276378294 195939520 774230261 389813264 982059869 291850838 281913196 120767384 883852143 635936961 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 250000 numbers

Test #12:

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

input:

499 500
5 497
6 494
4 491
5 492
7 497
2 495
8 494
3 491
9 495
3 496
9 497
8 490
6 500
4 491
6 490
9 496
3 490
2 495
7 492
4 494
9 494
4 494
4 496
7 496
9 491
1 490
10 498
1 496
9 500
6 500
10 498
2 492
8 490
10 498
6 493
1 499
8 497
10 498
9 494
5 492
6 497
9 497
6 492
9 492
10 496
9 493
1 499
4 496...

output:

9 494
7 500

result:

wrong answer 1st numbers differ - expected: '492', found: '9'