QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#408404#8422. Tree Average Weightucup-team278#AC ✓19ms7836kbC++20906b2024-05-10 10:03:022024-05-10 10:03:02

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 -1 -1 -1 -1

output:

67

result:

ok 1 number(s): "67"

Test #2:

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

input:

5
-1 -1 -1 -1 1

output:

52

result:

ok 1 number(s): "52"

Test #3:

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

input:

4
1 1 1 3

output:

42

result:

ok 1 number(s): "42"

Test #4:

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

input:

4
1 1 2 2

output:

38

result:

ok 1 number(s): "38"

Test #5:

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

input:

2
-1 -1

output:

3

result:

ok 1 number(s): "3"

Test #6:

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

input:

3
-1 -1 -1

output:

12

result:

ok 1 number(s): "12"

Test #7:

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

input:

4
-1 -1 -1 -1

output:

30

result:

ok 1 number(s): "30"

Test #8:

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

input:

4
1 -1 -1 -1

output:

34

result:

ok 1 number(s): "34"

Test #9:

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

input:

4
2 -1 -1 -1

output:

26

result:

ok 1 number(s): "26"

Test #10:

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

input:

4
3 -1 -1 -1

output:

18

result:

ok 1 number(s): "18"

Test #11:

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

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

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

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

input:

2
1 1

output:

3

result:

ok 1 number(s): "3"

Test #15:

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

input:

2
-1 1

output:

3

result:

ok 1 number(s): "3"

Test #16:

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

input:

2
-1 -1

output:

3

result:

ok 1 number(s): "3"

Test #17:

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

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

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

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

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

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: 0ms
memory: 7680kb

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: 11ms
memory: 7604kb

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: 4ms
memory: 7820kb

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: 5ms
memory: 7596kb

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: 19ms
memory: 7560kb

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: 6ms
memory: 7812kb

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: 4ms
memory: 4980kb

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: 4ms
memory: 6772kb

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: 4ms
memory: 7220kb

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: 6ms
memory: 7728kb

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: 9ms
memory: 7600kb

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: 10ms
memory: 7836kb

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"