QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#628317#8422. Tree Average Weightucup-team4645#AC ✓35ms3844kbC++231.1kb2024-10-10 19:36:472024-10-10 19:36:48

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 -1 -1 -1 -1

output:

67

result:

ok 1 number(s): "67"

Test #2:

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

input:

5
-1 -1 -1 -1 1

output:

52

result:

ok 1 number(s): "52"

Test #3:

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

input:

4
1 1 1 3

output:

42

result:

ok 1 number(s): "42"

Test #4:

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

input:

4
1 1 2 2

output:

38

result:

ok 1 number(s): "38"

Test #5:

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

input:

2
-1 -1

output:

3

result:

ok 1 number(s): "3"

Test #6:

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

input:

3
-1 -1 -1

output:

12

result:

ok 1 number(s): "12"

Test #7:

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

input:

4
-1 -1 -1 -1

output:

30

result:

ok 1 number(s): "30"

Test #8:

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

input:

4
1 -1 -1 -1

output:

34

result:

ok 1 number(s): "34"

Test #9:

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

input:

4
2 -1 -1 -1

output:

26

result:

ok 1 number(s): "26"

Test #10:

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

input:

4
3 -1 -1 -1

output:

18

result:

ok 1 number(s): "18"

Test #11:

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

input:

8
-1 -1 -1 -1 -1 -1 -1 -1

output:

252

result:

ok 1 number(s): "252"

Test #12:

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

input:

9
-1 -1 -1 -1 -1 -1 -1 -1 -1

output:

360

result:

ok 1 number(s): "360"

Test #13:

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

input:

10
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1

output:

495

result:

ok 1 number(s): "495"

Test #14:

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

input:

2
1 1

output:

3

result:

ok 1 number(s): "3"

Test #15:

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

input:

2
-1 1

output:

3

result:

ok 1 number(s): "3"

Test #16:

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

input:

2
-1 -1

output:

3

result:

ok 1 number(s): "3"

Test #17:

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

input:

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

output:

543550

result:

ok 1 number(s): "543550"

Test #18:

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

input:

111
3 1 2 3 2 1 2 -1 1 3 -1 1 3 2 4 1 -1 3 1 1 2 -1 3 2 4 3 4 2 3 2 1 2 2 3 2 1 4 2 3 4 1 1 1 -1 2 1 1 1 2 1 3 1 3 2 1 3 2 1 1 1 3 2 -1 1 -1 2 2 1 -1 1 3 1 1 2 1 2 3 1 -1 2 2 2 -1 -1 2 -1 2 3 2 3 1 1 3 4 1 2 2 3 2 -1 2 2 1 3 1 2 1 4 1 4 1

output:

664813

result:

ok 1 number(s): "664813"

Test #19:

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

input:

111
-1 4 1 3 2 1 2 -1 3 -1 -1 -1 1 -1 -1 -1 -1 -1 1 2 2 3 -1 -1 3 -1 3 -1 1 1 1 3 -1 -1 -1 1 1 -1 -1 -1 2 2 2 1 3 -1 -1 2 1 -1 2 -1 -1 2 1 -1 -1 1 1 -1 2 2 1 -1 -1 -1 3 -1 -1 2 1 -1 -1 1 -1 4 2 -1 -1 -1 2 1 -1 1 2 3 -1 -1 -1 2 1 2 2 -1 -1 2 2 -1 -1 1 -1 -1 -1 -1 1 3 -1 1 2 3 1

output:

665295

result:

ok 1 number(s): "665295"

Test #20:

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

input:

113
1 -1 1 -1 2 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 2 1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 2 -1 -1 -1 -1 2 -1 -1 -1 3 -1 2 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 1 1 2 -1 -1 -1 -1 2 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 2 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -...

output:

719191

result:

ok 1 number(s): "719191"

Test #21:

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

input:

120
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

863940

result:

ok 1 number(s): "863940"

Test #22:

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

input:

1000000
1 2 2 3 2 1 3 2 1 3 4 1 1 2 3 1 2 2 4 1 4 3 1 2 1 2 2 4 1 2 3 2 2 2 1 2 3 1 2 2 2 3 2 2 1 1 2 1 3 2 2 2 1 1 1 2 3 2 3 1 2 1 2 2 1 2 2 4 3 1 1 1 2 2 3 4 2 1 2 2 1 1 2 1 2 3 2 2 4 1 2 4 1 3 3 4 2 2 1 2 1 3 3 2 2 2 2 2 2 2 2 5 2 4 2 2 2 1 3 2 3 3 1 1 5 3 1 1 1 1 2 2 2 1 2 1 2 1 2 1 1 4 4 1 2 2 ...

output:

499668772865500000

result:

ok 1 number(s): "499668772865500000"

Test #23:

score: 0
Accepted
time: 31ms
memory: 3612kb

input:

1000000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

499999999999500000

result:

ok 1 number(s): "499999999999500000"

Test #24:

score: 0
Accepted
time: 28ms
memory: 3556kb

input:

1000000
3 2 1 1 1 4 2 2 2 2 1 1 -1 4 2 2 2 2 3 1 2 2 2 2 -1 1 5 1 2 3 2 3 3 3 1 1 2 3 2 2 1 1 1 1 3 1 2 1 3 -1 3 2 1 3 2 1 1 1 1 1 2 2 2 3 2 3 1 4 1 1 1 2 1 1 2 3 1 2 3 2 4 5 2 2 2 2 1 1 1 2 2 2 3 -1 2 2 3 1 2 3 1 2 2 2 2 1 2 2 1 2 3 1 4 3 1 1 1 2 2 1 2 2 1 1 1 3 2 3 1 1 1 2 2 1 4 2 1 2 3 2 1 3 4 4 ...

output:

499974321934095000

result:

ok 1 number(s): "499974321934095000"

Test #25:

score: 0
Accepted
time: 28ms
memory: 3624kb

input:

1000000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

499933882421758854

result:

ok 1 number(s): "499933882421758854"

Test #26:

score: 0
Accepted
time: 35ms
memory: 3556kb

input:

1000000
2 -1 -1 2 -1 -1 -1 2 -1 3 2 -1 2 -1 2 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 2 -1 1 2 -1 1 3 -1 3 -1 2 -1 2 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 1 2 -1 1 1 2 1 -1 -1 3 -1 -1 -1 -1 -1 3 5 4 -1 -1 3 -1 -1 -1 1 -1 1 2 -1 1 2 -1 -1 -1 -1 1 -1 -1 2 -1 4 1 1 -1 1 1 2 1 2 -1 -1 -1 2 1 1...

output:

499955386620526549

result:

ok 1 number(s): "499955386620526549"

Test #27:

score: 0
Accepted
time: 23ms
memory: 3548kb

input:

999777
5 2 1 1 1 3 2 2 1 3 3 2 1 2 3 2 3 1 2 3 2 3 1 1 1 2 3 2 3 1 1 2 3 1 1 2 4 4 2 3 1 2 1 2 2 2 1 2 2 2 1 3 1 2 3 1 2 1 1 1 2 3 1 1 3 1 4 2 1 3 1 1 1 1 2 3 2 1 2 1 2 1 2 2 1 2 2 2 2 1 1 2 2 2 2 1 3 3 2 2 3 2 3 1 2 1 3 3 2 1 1 3 2 1 3 3 2 3 4 1 3 4 3 1 1 2 3 2 4 3 3 2 2 2 2 3 1 1 3 3 2 2 1 1 2 2 1...

output:

499765687006416622

result:

ok 1 number(s): "499765687006416622"

Test #28:

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

input:

245763
-1 -1 4 2 2 1 2 1 -1 2 2 1 -1 1 1 1 4 -1 2 1 3 -1 2 4 -1 1 -1 2 3 3 1 2 1 -1 2 1 2 -1 2 2 2 1 2 -1 1 -1 1 -1 -1 1 -1 3 -1 2 1 1 1 1 2 2 2 2 1 1 -1 -1 2 1 -1 2 1 1 1 1 2 -1 1 2 3 2 2 1 1 2 2 2 2 1 3 1 4 3 1 2 1 -1 1 1 1 1 -1 3 -1 2 1 4 -1 3 1 1 2 3 -1 3 4 -1 1 -1 2 1 2 2 -1 3 -1 -1 3 -1 1 1 2 ...

output:

7420520871157922

result:

ok 1 number(s): "7420520871157922"

Test #29:

score: 0
Accepted
time: 25ms
memory: 3616kb

input:

785985
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

242785867241318274

result:

ok 1 number(s): "242785867241318274"

Test #30:

score: 0
Accepted
time: 11ms
memory: 3556kb

input:

386257
1 3 5 3 3 1 2 1 2 2 1 2 3 3 2 1 2 2 2 2 1 -1 2 2 2 5 2 3 -1 1 1 1 2 3 2 1 2 2 4 1 1 1 7 2 2 2 2 2 2 2 3 3 3 1 2 2 1 3 2 2 2 -1 2 2 2 2 1 3 1 1 2 2 1 1 2 2 2 3 2 1 1 2 1 4 2 2 1 3 2 1 2 1 3 5 3 2 2 1 3 1 1 3 1 1 2 2 3 1 1 2 2 3 2 2 3 3 3 4 3 3 -1 3 3 3 1 -1 1 2 3 2 2 2 1 2 2 1 1 2 1 3 1 1 2 1 ...

output:

28826864352211423

result:

ok 1 number(s): "28826864352211423"

Test #31:

score: 0
Accepted
time: 27ms
memory: 3556kb

input:

974693
1 1 2 2 1 2 1 2 2 2 2 2 1 2 2 3 2 1 1 1 1 1 1 1 6 1 2 4 2 1 2 2 1 3 1 4 3 1 1 1 2 2 3 1 2 2 2 2 1 2 3 1 1 3 4 3 1 1 2 1 3 2 2 2 3 1 2 2 2 1 1 3 3 5 2 3 2 1 1 2 3 2 1 1 1 7 3 5 1 2 2 2 3 1 3 3 2 2 2 4 4 3 1 1 1 1 1 4 1 1 1 2 1 2 2 2 2 3 1 2 2 2 1 2 1 2 5 2 3 1 3 1 1 2 2 2 1 1 2 1 3 1 3 1 1 1 2...

output:

463309455987012033

result:

ok 1 number(s): "463309455987012033"

Test #32:

score: 0
Accepted
time: 30ms
memory: 3776kb

input:

1000000
2 -1 1 1 -1 -1 -1 2 1 2 1 2 2 1 2 4 2 -1 -1 -1 -1 1 3 1 1 2 3 2 1 2 2 3 4 -1 -1 1 2 3 1 1 2 2 1 1 1 2 2 3 1 3 1 1 4 -1 1 1 2 3 2 3 1 -1 -1 -1 -1 2 2 1 1 2 1 3 -1 3 3 3 3 2 2 -1 2 -1 2 -1 1 2 2 -1 1 1 1 1 2 2 2 -1 2 5 -1 1 2 1 2 2 1 2 2 1 3 1 2 2 -1 3 4 4 3 1 2 1 -1 2 2 2 3 2 2 2 3 3 1 1 2 2 ...

output:

499797136089087394

result:

ok 1 number(s): "499797136089087394"

Test #33:

score: 0
Accepted
time: 30ms
memory: 3844kb

input:

1000000
1 3 2 -1 1 2 -1 1 1 2 2 4 1 1 2 2 -1 -1 -1 1 4 2 -1 2 2 -1 3 1 2 2 3 2 2 1 2 2 1 2 2 1 1 3 1 2 2 2 -1 -1 2 -1 2 -1 -1 -1 2 1 2 3 1 2 1 -1 2 3 2 -1 1 1 -1 -1 1 -1 3 3 2 2 -1 1 1 -1 3 2 3 1 2 5 1 2 1 2 5 2 3 -1 1 2 2 2 1 3 2 2 4 1 1 -1 2 3 2 1 3 2 1 2 2 1 -1 -1 2 3 1 -1 1 -1 4 1 -1 2 1 2 2 1 2...

output:

499849497199243155

result:

ok 1 number(s): "499849497199243155"