QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#877568#8987. Colorful TreesHuangHanShengTL 0ms3840kbC++201.9kb2025-01-31 23:24:462025-01-31 23:24:48

詳細信息

Test #1:

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

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

input:

4
2
2
2
2
3 4
2 4
1 2

output:

3
4
3

result:

ok 3 lines

Test #3:

score: -100
Time Limit Exceeded

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: