QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877420#8987. Colorful TreesHuangHanShengTL 305ms78396kbC++171.4kb2025-01-31 22:05:332025-01-31 22:05:34

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
3
1
2
1
2
2
2 6
4 5
1 4
3 4
1 2

output:

2
2
3
2
3

result:

ok 5 lines

Test #2:

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

input:

4
2
2
2
2
3 4
2 4
1 2

output:

3
4
3

result:

ok 3 lines

Test #3:

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

input:

1000
434
434
434
434
884
434
711
711
711
434
711
434
711
711
434
711
711
434
884
884
434
884
884
434
434
434
884
711
884
884
884
711
711
434
884
884
884
434
884
711
711
884
434
434
884
884
434
884
711
711
434
434
711
711
711
434
711
434
711
434
434
434
434
434
711
434
711
711
434
434
711
711
884
884...

output:

330
330
83135
2982
671
326
341
658
341
341
330
1336
2967
326
656
82955
330
1017
17531
28601
330
6562
330
2609
3285
326
1325
341
15484
330
330
650
330
999
1006
3297
1310
341
997
671
326
42631
1330
326
341
330
3632
42263
341
4594
12820
667
984
6535
10971
341
4927
326
671
984
1678
341
10973
326
1321
13...

result:

ok 999 lines

Test #4:

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

input:

1000
471
78
812
78
985
471
558
812
471
272
812
272
78
166
471
558
636
471
166
471
636
471
636
812
166
558
272
166
272
26
166
636
272
558
812
176
636
78
812
26
272
166
166
471
471
636
558
471
78
636
985
636
166
985
272
636
636
985
26
558
471
272
471
166
471
985
985
558
636
812
26
78
166
166
78
272
27...

output:

9777
1995
487
731
111
208
404
111
1140
97
165
223
1643
188
731
177
219
220
302
486
115
108
108
2614
91
307
421
1244
111
97
85
208
80
102
885
1773
584
107
85
115
14532
1004
21555
3538
1976
107
311
91
94
3692
15198
6783
500
85
107
115
6563
111
111
420
1192
196
199
7951
7516
80
882
4048
404
2098
1909
1...

result:

ok 999 lines

Test #5:

score: 0
Accepted
time: 305ms
memory: 78396kb

input:

100000
99376
19471
9376
43489
53777
4285
66420
90046
31405
93709
24806
60132
65592
4285
50150
3226
44744
91246
93926
66420
36163
12713
90046
3985
83412
52741
93019
52741
49766
40942
19471
99533
92267
20340
65592
69144
93926
94548
60132
58733
86983
2234
55482
93861
23243
36163
72474
92267
91246
15090...

output:

2060
1036
1992
984
930
3049
16094
30910
1030
985
2047
944
1069
1005
1021
8958
1040
2011
1958
991
125271
29973
37721
2064
46919
32914
2003
6814
2009
8898
2056
61557
9930
1003
1019
1011
996
1986
934
1026
2043
3039
4922
1030
1012
2956
4972
1996
7031
1954
680696
1972
3026
1026
1035
8939
980
2008
3041
10...

result:

ok 99999 lines

Test #6:

score: -100
Time Limit Exceeded

input:

100000
23661
20545
24000
44092
86565
22129
78304
223
32394
3696
90769
60763
95886
95273
52852
94717
2191
99763
41371
18365
54065
40239
78199
99695
67395
22634
15005
81959
23958
83229
78339
59719
10679
86176
2658
13547
11960
2563
71194
23272
50218
29628
1250
96244
929
21621
67963
88741
57927
86259
45...

output:

9
144
576
9
36
684
243
27
9
9
63
9
9
270
9
9
243
54
378
27
18
9
36
54
137582
340
207
9
261
3392
9
108
9
9
693
9
9
54
9
6755
198
682
27
18
9
9
18
9
9
63
18
18
9
9
9
9
36
18
135
108
126
171
18
162
9
18
9
18
9
234
108
9
997
9
9
28444
27
252
45
738
9
36
9
36
9
27
9
36
9
9
117
9
18
9
2855
18
18
45
648
29...

result: