QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#49988#863. Adjacent RooksGuanYunchangAC ✓9ms10644kbC++11875b2022-09-24 13:16:282022-09-24 13:16:28

詳細信息

Test #1:

score: 100
Accepted
time: 5ms
memory: 10544kb

input:

5
1 0
2 0
3 1
3 2
4 2

output:

1
0
4
2
10

result:

ok 5 number(s): "1 0 4 2 10"

Test #2:

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

input:

1
1000 999

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

66
1 0
2 0
2 1
3 0
3 1
3 2
4 0
4 1
4 2
4 3
5 0
5 1
5 2
5 3
5 4
6 0
6 1
6 2
6 3
6 4
6 5
7 0
7 1
7 2
7 3
7 4
7 5
7 6
8 0
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 0
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 0
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 0
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10

output:

1
0
2
0
4
2
2
10
10
2
14
40
48
16
2
90
230
256
120
22
2
646
1580
1670
888
226
28
2
5242
12434
12846
7198
2198
366
34
2
47622
110320
112820
64968
22120
4448
540
40
2
479306
1090270
1108612
650644
236968
54304
7900
748
46
2
5296790
11876980
12032154
7165200
2732268
685368
114180
12816
990
52
2

result:

ok 66 numbers

Test #4:

score: 0
Accepted
time: 7ms
memory: 10632kb

input:

10
1000 0
1000 1
1000 2
1000 3
1000 4
1000 5
1000 6
1000 7
1000 8
1000 9

output:

711794305
99846303
899237562
681335754
230732925
841887937
326646608
783522506
856793774
627151005

result:

ok 10 numbers

Test #5:

score: 0
Accepted
time: 4ms
memory: 10524kb

input:

4950
1 0
2 0
2 1
3 0
3 1
3 2
4 0
4 1
4 2
4 3
5 0
5 1
5 2
5 3
5 4
6 0
6 1
6 2
6 3
6 4
6 5
7 0
7 1
7 2
7 3
7 4
7 5
7 6
8 0
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 0
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 0
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 0
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 0
12 1...

output:

1
0
2
0
4
2
2
10
10
2
14
40
48
16
2
90
230
256
120
22
2
646
1580
1670
888
226
28
2
5242
12434
12846
7198
2198
366
34
2
47622
110320
112820
64968
22120
4448
540
40
2
479306
1090270
1108612
650644
236968
54304
7900
748
46
2
5296790
11876980
12032154
7165200
2732268
685368
114180
12816
990
52
2
6377903...

result:

ok 4950 numbers

Test #6:

score: 0
Accepted
time: 9ms
memory: 10636kb

input:

5000
500 0
500 1
500 2
500 3
500 4
500 5
500 6
500 7
500 8
500 9
500 10
500 11
500 12
500 13
500 14
500 15
500 16
500 17
500 18
500 19
500 20
500 21
500 22
500 23
500 24
500 25
500 26
500 27
500 28
500 29
500 30
500 31
500 32
500 33
500 34
500 35
500 36
500 37
500 38
500 39
500 40
500 41
500 42
500 ...

output:

167188736
316449409
603617229
998698265
726709812
552770219
568103495
610733818
349517444
237622229
125671716
671304862
760588271
86504235
907515439
868670783
260264553
192919746
788292446
142919800
793243931
638191717
688713858
723184843
16251965
277668091
281930424
637634330
28576460
905022490
890...

result:

ok 5000 numbers

Test #7:

score: 0
Accepted
time: 4ms
memory: 10540kb

input:

5000
37 19
94 11
58 22
60 22
93 46
76 6
74 66
54 46
26 11
65 31
60 51
88 27
74 50
71 58
43 36
86 17
59 5
62 10
79 3
89 37
73 6
85 61
28 13
76 58
55 4
36 34
26 22
46 3
42 22
90 76
75 35
48 12
66 56
92 48
32 29
40 2
84 5
71 36
55 40
88 43
31 25
96 28
95 71
41 16
78 33
58 38
45 33
84 55
72 5
99 88
62 1...

output:

555630903
255802975
481681282
312032507
731559619
369007971
553385499
389699305
378479549
504211558
614558812
176176262
405356428
282262271
230954080
515488232
589339575
859919989
636068487
33115605
621417012
48807276
502416664
199370048
697178319
202
440396
44482173
573701993
484946907
144608978
46...

result:

ok 5000 numbers

Test #8:

score: 0
Accepted
time: 2ms
memory: 10640kb

input:

5000
907 50
910 27
999 47
909 38
906 17
982 42
957 14
914 33
975 12
979 15
977 7
954 27
963 43
976 6
989 16
925 35
999 10
934 48
940 7
907 25
958 42
964 41
936 28
908 40
950 36
943 35
942 35
913 13
980 47
968 45
997 39
984 47
923 39
987 9
995 32
949 47
939 13
913 35
931 31
950 7
993 21
945 7
964 14
...

output:

97192348
911642876
905118777
666649435
280578094
156043564
896800765
698913153
164621466
581058016
13264378
474323988
562744469
602361065
917349637
188914758
288326656
562733487
529888103
90737189
945744431
971596583
249542586
392217838
577134197
523691009
806033602
430896340
118354214
269581824
253...

result:

ok 5000 numbers

Test #9:

score: 0
Accepted
time: 4ms
memory: 10596kb

input:

5000
970 964
962 961
966 958
981 979
980 950
990 983
979 976
959 952
993 983
976 966
996 991
988 961
994 988
998 973
999 965
984 961
1000 979
964 959
988 967
992 954
985 953
976 954
989 982
958 951
956 954
989 961
989 979
991 964
986 951
981 952
975 974
987 974
987 972
987 969
999 961
995 972
1000 9...

output:

434726412
2
257073191
5872
884739074
121862586
16181110
889440701
608069190
403707522
769108220
545881853
121325232
305319836
316957560
835361341
176908545
439869337
906356564
336120386
228324162
527699741
88560723
848602460
5722
785634178
568444309
745354358
14226151
953838261
2
175110413
676105660...

result:

ok 5000 numbers

Test #10:

score: 0
Accepted
time: 2ms
memory: 10588kb

input:

5000
924 220
931 854
904 426
996 357
942 726
972 625
923 906
902 413
912 554
999 556
985 601
997 425
985 885
984 423
990 740
979 545
968 451
983 285
986 947
953 158
946 385
981 427
984 77
990 694
941 494
902 724
998 247
935 290
916 467
913 192
912 450
977 146
942 412
909 708
905 660
919 3
972 18
966...

output:

3092346
835778340
574211873
992525949
55729725
620587427
93488524
989259408
612769491
238033880
435947052
81975529
878046302
436385388
376807648
127617352
287517126
764988109
403001091
75491631
204736138
70121433
386188081
685563269
986830085
654497725
717047354
546557085
880505643
19973947
90082127...

result:

ok 5000 numbers

Test #11:

score: 0
Accepted
time: 4ms
memory: 10528kb

input:

5000
923 16
255 26
880 10
763 18
792 31
781 36
172 36
377 32
696 12
796 8
363 33
976 30
857 23
204 31
92 37
39 10
614 7
498 37
196 18
426 3
445 36
770 48
529 27
674 28
622 2
933 34
983 50
32 20
590 44
125 16
365 36
99 2
62 17
115 10
636 10
813 23
184 11
657 1
204 7
999 42
187 24
895 45
449 45
962 9
...

output:

740257417
774207596
427466017
182701610
224827464
177593523
444247520
174406747
493888670
698439978
265945060
45694039
557764645
33023813
354770694
669105240
740126415
113406396
909197811
142832202
928485632
137090581
577077787
857784583
276265228
458468818
425820644
390086797
24912231
646622818
615...

result:

ok 5000 numbers

Test #12:

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

input:

5000
990 974
998 953
1000 987
995 962
970 967
991 956
980 973
970 963
987 960
999 984
978 961
986 972
972 956
985 968
999 964
988 950
960 959
994 970
993 986
977 953
966 956
994 955
968 965
983 969
986 955
991 962
964 951
982 971
963 957
986 981
999 968
999 968
979 973
985 965
969 956
977 952
990 97...

output:

551666571
964605564
547583815
79232975
15883948
152391484
100196131
893941284
300009364
745433560
877740842
188169804
52541601
482674840
414352643
636420240
2
48142028
313498954
625418272
972764405
582375317
15818286
19141165
322569742
388711823
533139089
55303546
986611695
837751836
610492948
61049...

result:

ok 5000 numbers

Test #13:

score: 0
Accepted
time: 9ms
memory: 10520kb

input:

5000
430 25
997 703
546 46
690 126
996 567
989 343
756 133
531 310
585 247
584 539
594 123
935 775
481 419
691 337
780 564
815 464
802 764
746 469
971 561
633 293
904 215
882 654
627 369
759 41
475 214
603 239
545 356
194 76
606 583
865 395
622 317
517 193
938 271
544 297
718 462
969 738
947 481
539...

output:

385805768
465321378
488889656
36039771
850812083
481333727
753892030
883418836
671633562
679092939
235456255
951005802
51290189
565625274
800946539
200125374
222936655
161343783
473627917
143656114
884927835
523424702
52794978
365353256
417714889
669344977
271562528
976081335
736106990
616846755
841...

result:

ok 5000 numbers