QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877347#8987. Colorful TreesZhangYiDeWA 399ms67144kbC++232.1kb2025-01-31 21:29:232025-01-31 21:29:24

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: 1ms
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: 1ms
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: 274ms
memory: 52160kb

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: 0
Accepted
time: 399ms
memory: 67144kb

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:

ok 99999 lines

Test #7:

score: 0
Accepted
time: 393ms
memory: 65168kb

input:

100000
79671
87547
79964
44971
61768
85621
99923
57509
83754
1825
97590
68371
70024
49463
77791
5759
51803
14921
16631
20816
11786
87719
15214
71966
74479
14091
10216
84444
37530
52784
62360
96306
78776
31914
39819
93999
33458
4610
83942
2304
93983
53377
10884
65134
46015
39258
13113
33470
32576
245...

output:

76
57
4517
38
114
11397
19
19
19
57
38
38
71697
38
114
19
285
19
76
38
133
95
19
57
19
19
152
114
76
19
19
19
19
19
190
38
2886
38
76
19
19
76
304
475
19
76
209
152
76
304
380
95
95
38
19
38
76
76
19
38
95
38
76
969
361
38
19
1007
19
19
33261
38
19
19
684
57
19
19
57
969
152
19
19
95
38
19
38
19
19
...

result:

ok 99999 lines

Test #8:

score: 0
Accepted
time: 202ms
memory: 41364kb

input:

100000
17026
95038
17026
95038
17026
17026
95038
17026
17026
17026
17026
17026
95038
95038
95038
95038
95038
17026
17026
95038
17026
95038
95038
17026
17026
95038
95038
17026
95038
17026
95038
95038
17026
95038
95038
95038
95038
17026
95038
95038
17026
95038
95038
17026
17026
95038
95038
95038
95038...

output:

50210
2749530
26698308
199568
149784
49788
50210
200412
49788
100418
49788
50210
199992
199568
49788
99998
99574
49788
249776
99998
49788
99998
149784
50210
3197100
400804
50210
50210
49788
1698998
400388
50210
338416088
50210
49788
99574
199992
49788
49788
49788
299130
701558
100418
49788
1251140
1...

result:

ok 99999 lines

Test #9:

score: -100
Wrong Answer
time: 203ms
memory: 39752kb

input:

100000
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150
97150...

output:

99999
4298151
199996
199996
299991
199996
199996
699951
11885839
99999
99999
199996
99999
199996
199996
7793916
299991
99999
99999
99999
99999
99999
99999
99999
99999
1399804
299991
99999
199996
299991
99999
299991
99999
99999
499975
16572444
199996
299991
2799216
3198976
99999
99999
99999
99999
129...

result:

wrong answer 1027th lines differ - expected: '2499382204', found: '-1795585092'