QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#38169#832. Best TreeZhangYiDeWA 25ms3760kbC++14793b2022-07-04 13:11:392022-07-04 13:11:42

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

1
2
1 1

output:

1

result:

ok "1"

Test #3:

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

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: 25ms
memory: 3760kb

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: 22ms
memory: 3680kb

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: 22ms
memory: 3756kb

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

result:

ok 25000 tokens

Test #9:

score: 0
Accepted
time: 15ms
memory: 3680kb

input:

22222
9
2 2 3 1 1 1 1 2 3
9
1 2 1 1 3 2 3 1 2
9
1 1 1 4 1 2 2 3 1
9
1 1 1 2 1 1 4 3 2
9
1 1 4 1 2 3 1 2 1
9
1 2 1 1 2 3 2 3 1
9
2 1 2 1 3 1 3 2 1
9
1 1 1 6 1 3 1 1 1
9
3 2 2 3 1 1 1 1 2
9
4 2 3 1 1 1 2 1 1
9
2 3 2 2 3 1 1 1 1
9
6 1 1 1 2 1 1 2 1
9
1 2 1 1 3 1 2 4 1
9
1 1 2 1 3 3 1 2 2
9
1 2 2 1 2 4 ...

output:

4
4
4
4
4
4
4
2
4
4
4
3
4
4
4
4
4
2
4
4
4
4
4
4
4
4
4
4
3
4
4
3
4
4
4
3
4
4
4
4
4
3
4
4
4
4
4
3
3
4
4
3
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
3
4
4
4
4
4
4
3
4
4
4
4
4
4
4
4
4
4
4
3
3
4
4
4
4
4
4
4
4
3
3
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
3
4
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
...

result:

ok 22222 tokens

Test #10:

score: -100
Wrong Answer
time: 21ms
memory: 3700kb

input:

20000
10
3 2 2 1 1 1 1 2 4 1
10
2 3 1 1 1 1 3 1 1 4
10
2 1 1 1 1 6 1 1 1 3
10
1 2 3 1 2 1 2 3 1 2
10
3 1 4 2 2 1 1 1 2 1
10
1 3 2 2 1 1 5 1 1 1
10
1 2 4 1 3 2 1 1 1 2
10
4 2 1 1 3 2 1 1 2 1
10
1 3 1 2 3 1 3 2 1 1
10
1 1 3 2 4 1 2 1 1 2
10
2 1 4 1 1 1 3 1 1 3
10
1 1 1 3 5 1 1 1 3 1
10
1 1 3 2 1 1 2 2...

output:

5
4
3
5
5
4
5
5
5
5
4
3
5
5
5
3
4
5
5
5
4
5
5
5
5
5
5
5
5
5
4
5
4
4
5
4
3
5
5
4
5
5
5
5
3
5
5
5
5
5
5
5
5
5
5
4
5
4
5
4
5
5
5
5
5
5
5
5
4
5
3
4
3
5
5
5
5
5
4
5
5
5
5
4
5
5
4
5
5
5
5
4
4
4
5
5
5
5
4
5
5
5
5
4
5
5
4
5
5
5
5
5
5
5
5
5
5
5
5
5
4
3
5
5
4
5
5
5
4
5
4
5
4
4
4
5
4
5
5
4
3
5
5
5
5
5
5
4
5
5
...

result:

wrong answer 133rd words differ - expected: '5', found: '4'