QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#45598#4565. Rarest InsectsZhangYiDe10 339ms3892kbC++171.2kb2022-08-24 13:22:032022-08-24 13:22:11

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 4ms
memory: 3836kb

input:

6
1
1
1
2
1
1
1
1
2
1
1
1
2
1
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
1 3
8
0 4
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 4
8
0 5
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
...

result:

ok 

Test #2:

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

input:

2
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
3 2

result:

ok 

Test #3:

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

input:

2
1

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
3 1

result:

ok 

Test #4:

score: 0
Accepted
time: 3ms
memory: 3752kb

input:

3
1
1
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
3 1

result:

ok 

Test #5:

score: 0
Accepted
time: 4ms
memory: 3760kb

input:

5
1
1
2
2
1
1
2
1
1
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
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8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
1 3
8
0 4
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 4
8
0 5
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
...

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 316ms
memory: 3868kb

input:

1000
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
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
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
1 3
8
0 4
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 4
8
0 5
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
...

result:

wrong answer Too many queries.

Subtask #3:

score: 0
Wrong Answer

Test #43:

score: 75
Accepted
time: 2ms
memory: 3852kb

input:

2
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
3 2

result:

ok 

Test #44:

score: 75
Accepted
time: 3ms
memory: 3844kb

input:

2
1

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
3 1

result:

ok 

Test #45:

score: 75
Accepted
time: 0ms
memory: 3860kb

input:

3
1
1
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
3 1

result:

ok 

Test #46:

score: 72.83
Acceptable Answer
time: 0ms
memory: 3852kb

input:

6
2
1
1
2
2
1
2
2
1
2
2
2
1
2
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
1 3
8
0 4
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 4
8
0 5
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
...

result:

points 0.97106666670 points  0.97106666670

Test #47:

score: 60.83
Acceptable Answer
time: 4ms
memory: 3736kb

input:

10
1
1
2
1
2
2
2
1
1
1
2
1
1
1
2
2
1
1
1
2
2
1
2
2
2
1
1
1
2
1
1
1
2
2
2
1
2
1
1
1
2
2
2
1
2

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
1 3
8
0 4
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 4
8
0 5
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
...

result:

points 0.81106666670 points  0.81106666670

Test #48:

score: 0
Wrong Answer
time: 339ms
memory: 3892kb

input:

2000
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
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
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
1 0
8
0 1
8
0 0
8
2
8
1 0
8
1 1
8
0 2
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
1 2
8
0 3
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
1 3
8
0 4
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 4
8
0 5
8
0 0
8
2
8
1 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
...

result:

wrong answer Too many queries.