QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#67961#1997. CircusGuanYunchang100 ✓51ms15460kbC++112.5kb2022-12-13 18:09:452022-12-13 18:09:48

详细

Test #1:

score: 5
Accepted
time: 4ms
memory: 9092kb

input:

5
1 2
2 3
3 4
3 5

output:

1
1
3
24
120

result:

ok 5 lines

Test #2:

score: 5
Accepted
time: 4ms
memory: 8240kb

input:

8
1 3
2 3
3 4
4 5
5 6
6 7
6 8

output:

1
1
1
6
30
180
5040
40320

result:

ok 8 lines

Test #3:

score: 5
Accepted
time: 1ms
memory: 8096kb

input:

8
7 3
6 2
3 2
8 7
5 3
4 2
1 3

output:

1
1
1
1
1
60
5040
40320

result:

ok 8 lines

Test #4:

score: 5
Accepted
time: 2ms
memory: 8504kb

input:

8
5 1
4 6
1 7
2 3
7 8
3 6
6 1

output:

1
1
1
1
1
180
5040
40320

result:

ok 8 lines

Test #5:

score: 5
Accepted
time: 3ms
memory: 8304kb

input:

16
10 7
11 8
3 10
8 5
7 6
15 13
16 11
13 3
2 5
12 13
9 10
1 12
14 9
5 1
4 6

output:

1
1
1
1
1
1
1
1
1
1
1
495
7207200
897286330
674358851
789741546

result:

ok 16 lines

Test #6:

score: 5
Accepted
time: 0ms
memory: 7768kb

input:

16
10 8
8 12
1 7
4 10
16 9
11 9
15 7
13 3
5 14
14 2
6 10
9 3
2 4
12 16
7 14

output:

1
1
1
1
1
1
1
1
1
1
165
138600
7207200
448643165
674358851
789741546

result:

ok 16 lines

Test #7:

score: 5
Accepted
time: 1ms
memory: 6856kb

input:

16
8 2
13 4
1 12
15 12
3 12
5 12
9 3
6 1
2 3
14 11
11 16
10 16
12 16
4 15
7 6

output:

1
1
1
1
1
1
1
1
1
1
1
1
156
908107200
674358851
789741546

result:

ok 16 lines

Test #8:

score: 5
Accepted
time: 2ms
memory: 7900kb

input:

100
39 59
65 51
36 58
2 7
50 75
57 26
26 22
31 14
41 44
69 47
98 45
14 7
72 53
27 37
49 50
25 68
99 84
54 30
100 32
37 28
29 13
53 10
1 40
45 93
96 92
48 54
60 88
52 62
5 12
55 76
95 17
30 99
21 87
94 90
28 16
11 49
91 9
82 80
47 97
85 70
83 91
75 96
12 71
35 81
2 71
6 43
23 5
84 94
2 38
24 20
10 46...

output:

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
77
456456
704501786
650543930
666231168
384749822
339488231
263873580
256467392
592480153
166496865
23513747
285250591
870654350
775003256
94613010
...

result:

ok 100 lines

Test #9:

score: 5
Accepted
time: 2ms
memory: 7860kb

input:

100
24 91
62 10
39 12
72 37
58 94
73 78
20 3
4 51
21 86
60 25
15 42
17 74
93 33
9 93
52 4
58 16
95 38
77 70
6 68
58 37
85 54
26 73
14 57
87 77
89 36
25 96
68 79
34 83
58 69
45 99
58 100
31 7
79 82
29 62
7 65
88 13
10 64
58 2
74 31
46 6
23 97
56 85
18 8
63 61
1 24
57 100
78 18
32 75
76 17
27 44
36 72...

output:

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
8010
580534925
535568681
144923834
378861334
204817852
526026206
458825696
628013919
104379182
437918130

result:

ok 100 lines

Test #10:

score: 5
Accepted
time: 4ms
memory: 8544kb

input:

100
38 1
57 53
95 2
38 8
36 8
38 96
80 57
40 70
38 54
38 19
38 26
44 11
28 65
38 66
38 47
91 26
38 24
38 34
38 64
4 51
73 93
7 32
38 61
68 79
38 49
38 93
25 15
6 5
38 58
3 29
38 59
18 58
51 1
38 37
11 54
17 96
62 37
85 72
81 24
39 45
38 10
38 16
56 98
42 90
15 78
38 21
23 92
74 99
38 33
70 83
30 40
...

output:

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
95
385114927
805147853
857580373
104379182
437918130

result:

ok 100 lines

Test #11:

score: 5
Accepted
time: 3ms
memory: 7924kb

input:

100
39 7
53 37
35 89
90 75
92 31
32 16
59 64
33 39
20 17
13 90
74 65
70 5
100 26
8 93
57 12
48 61
16 68
56 65
67 55
15 40
45 5
58 59
85 21
27 18
43 33
87 94
78 26
80 84
55 9
44 25
71 77
99 34
68 56
14 57
7 30
97 22
79 53
38 35
24 29
73 46
62 80
9 69
29 1
17 42
19 50
94 95
66 81
40 2
30 66
83 47
76 2...

output:

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
77
6006
474474
37957920
74591499
116502876
669738645
258045788
933891833
123819674
834120950
766106262
738175884
89204286
432531311
137746304
373611...

result:

ok 100 lines

Test #12:

score: 5
Accepted
time: 3ms
memory: 7556kb

input:

100
29 14
17 18
24 59
86 56
76 97
4 48
62 51
37 77
7 36
100 88
35 67
30 60
36 38
41 44
53 85
45 40
12 71
88 96
10 68
25 98
74 83
72 99
82 28
48 76
21 86
69 52
19 72
27 39
38 93
52 87
34 67
56 62
50 54
98 100
93 61
83 20
91 63
22 75
49 92
81 92
95 17
84 62
46 21
75 35
96 10
47 21
3 98
79 95
20 4
51 2...

output:

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
386097056
764070259
757754067
120631264
645164728
24462745
735163764
215926116
10249489
104379182
437918130

result:

ok 100 lines

Test #13:

score: 5
Accepted
time: 3ms
memory: 8632kb

input:

100
44 55
17 74
98 78
11 52
7 82
65 98
52 19
30 93
94 88
93 86
64 32
86 51
52 65
10 54
70 52
49 83
52 99
1 22
22 70
45 58
8 7
79 17
82 52
63 68
32 84
67 37
56 66
77 57
52 31
42 23
52 91
52 39
12 52
92 75
13 52
48 25
60 77
52 6
89 69
20 33
26 24
97 28
62 50
25 96
3 79
47 1
15 4
50 52
69 56
83 63
74 3...

output:

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
88
681384
273912125
710272049
535568681
828001454
861439352
5539605
117843940
32358966
128586038
104379182
437918130

result:

ok 100 lines

Test #14:

score: 5
Accepted
time: 1ms
memory: 7624kb

input:

100
15 51
37 85
97 73
3 70
38 100
88 37
39 72
54 99
90 33
2 90
90 7
25 12
59 76
47 45
67 56
18 64
87 9
77 20
22 36
42 41
78 1
46 5
55 42
32 15
90 23
83 59
64 29
81 90
69 28
16 88
21 54
72 3
85 18
98 50
30 87
35 53
93 85
99 49
27 61
41 26
13 52
33 95
43 96
26 4
51 69
63 97
34 30
60 27
29 57
95 19
52 ...

output:

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
84
7140
614040
53421480
701090212
397028434
802381225
368659041
844182690
736767900
126191889
967766494
561924362
950793510
851571117
...

result:

ok 100 lines

Test #15:

score: 5
Accepted
time: 2ms
memory: 7320kb

input:

100
62 43
68 49
82 62
11 2
39 55
7 26
61 74
98 19
23 59
70 93
59 77
10 21
76 67
45 44
44 79
74 84
51 97
95 15
29 62
26 27
57 95
5 12
94 45
16 54
24 70
22 86
58 80
42 7
50 11
2 31
52 3
36 99
62 64
62 25
72 94
38 36
17 98
46 92
99 23
15 100
62 50
64 58
41 62
56 73
90 89
66 61
12 24
6 40
60 41
47 62
48...

output:

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
72
5256
388944
29170800
216980786
707520410
186591595
740735907
258872147
968643767
428788341
589432058
512292529
685390878
53056678
499235808
612628725
77185...

result:

ok 100 lines

Test #16:

score: 5
Accepted
time: 42ms
memory: 15460kb

input:

100000
67515 71316
41069 67515
22587 41069
83003 22587
43078 83003
3140 43078
85511 3140
62902 85511
89400 62902
55238 89400
7417 55238
46880 7417
18160 46880
86464 18160
1256 86464
54875 1256
24869 54875
13748 24869
52002 13748
30604 52002
25051 30604
3579 25051
67408 3579
41523 67408
85918 41523
4...

output:

1
2
6
24
120
720
5040
40320
362880
3628800
39916800
479001600
227020758
178290591
674358851
789741546
425606191
660911389
557316307
146326063
72847302
602640637
860734560
657629300
440732388
459042011
394134213
35757887
36978716
109361473
390205642
486580460
57155068
943272305
14530444
523095984
354...

result:

ok 100000 lines

Test #17:

score: 5
Accepted
time: 51ms
memory: 13440kb

input:

100000
12693 8513
3031 12693
92095 3031
34967 92095
53825 92095
13010 53825
23444 53825
71614 23444
25832 71614
59196 25832
12560 59196
67458 12560
8696 67458
35863 92095
62479 35863
40225 3031
50081 40225
73243 50081
4706 73243
78049 4706
92353 78049
44136 92353
84302 44136
23500 84302
23254 23500
...

output:

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
1
1
...

result:

ok 100000 lines

Test #18:

score: 5
Accepted
time: 44ms
memory: 13412kb

input:

100000
87389 21211
5989 26538
48483 3065
98697 45584
17965 49151
84951 39036
11796 70123
76195 73679
4749 41762
39535 87138
841 77768
73153 89556
35515 86760
1200 32899
99598 27151
11680 84511
97802 75796
83519 69581
15851 35252
96791 78408
95718 4003
99266 63177
61859 37463
6407 55942
66130 2718
97...

output:

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
1
1
...

result:

ok 100000 lines

Test #19:

score: 5
Accepted
time: 39ms
memory: 11760kb

input:

100000
86469 54922
92857 98383
65976 96539
59270 31444
17838 42376
41534 63727
64782 7973
9100 3330
75256 57847
20032 12186
34938 58215
68148 73402
50006 76016
23213 45891
98648 98461
81751 70072
72326 90602
93730 83530
44045 52280
22230 29641
53607 72844
75491 47286
98335 95891
80206 1890
22712 658...

output:

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
1
1
...

result:

ok 100000 lines

Test #20:

score: 5
Accepted
time: 47ms
memory: 13144kb

input:

100000
8406 66852
27354 83520
16618 15340
96280 24193
98148 65816
80003 23323
44735 44910
11518 99335
69107 92999
4106 56728
22339 90945
45474 47760
43940 18956
67813 87021
70734 57456
4766 30574
36817 38160
13304 82453
87794 6302
40580 37316
1681 72942
12420 90363
48914 38763
68206 37385
80505 3073...

output:

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
1
1
...

result:

ok 100000 lines