QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#38153#832. Best TreeGuanYunchangWA 27ms3776kbC++14696b2022-07-04 12:27:502022-07-04 12:27:52

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3680kb

input:

2
10
1 1 2 2 2 2 2 2 2 2
5
4 1 1 1 1

output:

5
1

result:

ok 2 tokens

Test #2:

score: 0
Accepted
time: 2ms
memory: 3740kb

input:

1
2
1 1

output:

1

result:

ok "1"

Test #3:

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

input:

66666
3
1 2 1
3
1 2 1
3
1 2 1
3
1 1 2
3
2 1 1
3
1 2 1
3
1 1 2
3
1 1 2
3
2 1 1
3
2 1 1
3
1 1 2
3
1 1 2
3
1 2 1
3
1 1 2
3
1 1 2
3
1 2 1
3
1 1 2
3
1 1 2
3
1 2 1
3
2 1 1
3
2 1 1
3
1 1 2
3
2 1 1
3
2 1 1
3
1 1 2
3
1 2 1
3
2 1 1
3
2 1 1
3
1 1 2
3
1 1 2
3
1 1 2
3
1 1 2
3
1 2 1
3
2 1 1
3
2 1 1
3
1 1 2
3
1 1 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 66666 tokens

Test #4:

score: 0
Accepted
time: 22ms
memory: 3668kb

input:

50000
4
1 1 1 3
4
1 1 3 1
4
2 1 1 2
4
1 1 2 2
4
1 2 1 2
4
2 2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2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 40000 tokens

Test #6:

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

input:

33333
6
1 1 1 2 4 1
6
1 1 1 1 4 2
6
1 1 3 1 3 1
6
1 1 2 1 2 3
6
3 1 1 2 2 1
6
1 2 4 1 1 1
6
2 1 3 1 1 2
6
3 1 1 3 1 1
6
1 2 1 1 1 4
6
4 1 2 1 1 1
6
1 3 3 1 1 1
6
2 2 1 2 2 1
6
1 1 2 2 1 3
6
1 1 2 3 2 1
6
2 3 1 2 1 1
6
1 2 1 1 4 1
6
1 1 4 1 1 2
6
2 1 1 1 2 3
6
1 2 1 1 2 3
6
1 2 1 3 1 2
6
1 2 1 1 3 2
...

output:

2
2
2
3
3
2
3
2
2
2
2
3
3
3
3
2
2
3
3
3
3
3
2
3
2
2
2
3
3
3
3
3
3
2
2
3
2
3
3
3
3
3
3
3
3
1
2
3
2
3
3
3
2
2
3
3
3
2
3
3
3
3
2
3
2
3
2
3
2
2
2
3
3
2
3
2
3
3
3
2
3
2
3
3
3
3
2
3
3
3
2
3
3
2
3
2
2
3
3
2
2
2
3
3
3
2
3
3
2
3
2
3
3
3
3
2
3
3
2
3
3
3
2
3
2
3
3
3
3
3
3
2
3
3
3
3
3
2
2
2
3
2
3
3
2
3
3
3
3
2
...

result:

ok 33333 tokens

Test #7:

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

input:

28571
7
2 2 3 2 1 1 1
7
1 1 1 2 4 2 1
7
2 1 3 2 2 1 1
7
1 3 1 1 1 2 3
7
1 1 2 2 1 4 1
7
4 2 2 1 1 1 1
7
2 1 2 1 2 1 3
7
1 3 1 1 1 2 3
7
2 2 2 2 1 2 1
7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
4
3
3
3
3
3
4
4
3
4
4
4
3
3
3
3
4
3
3
3
4
4
3
3
4
3
3
3
4
3
3
3
3
4
2
3
3
4
4
4
3
3
3
...

result:

wrong answer 2nd words differ - expected: '4', found: '3'