QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#38267#840. Just CountingHuangHanShengWA 96ms9924kbC++11912b2022-07-05 00:19:032022-07-05 00:19:04

详细

Test #1:

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

input:

3
1 0
3 3
1 2
2 3
3 1
4 4
1 2
2 3
3 4
4 1

output:

1
1
5

result:

ok 3 number(s): "1 1 5"

Test #2:

score: 0
Accepted
time: 96ms
memory: 7724kb

input:

500000
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
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 500000 numbers

Test #3:

score: 0
Accepted
time: 51ms
memory: 5680kb

input:

250000
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 166666 numbers

Test #5:

score: 0
Accepted
time: 33ms
memory: 7852kb

input:

166666
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3...

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 166666 numbers

Test #6:

score: 0
Accepted
time: 38ms
memory: 9916kb

input:

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

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 34ms
memory: 9744kb

input:

83333
3 3
1 3
2 3
1 2
3 3
1 3
1 2
2 3
3 3
2 3
1 2
1 3
3 3
1 3
2 3
1 2
3 3
1 2
2 3
1 3
3 3
1 3
2 3
1 2
3 3
2 3
1 2
1 3
3 3
2 3
1 2
1 3
3 3
2 3
1 2
1 3
3 3
2 3
1 2
1 3
3 3
1 2
1 3
2 3
3 3
2 3
1 2
1 3
3 3
2 3
1 3
1 2
3 3
1 3
2 3
1 2
3 3
2 3
1 2
1 3
3 3
1 3
2 3
1 2
3 3
1 3
1 2
2 3
3 3
1 3
2 3
1 2
3 3
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 83333 numbers

Test #9:

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

input:

125000
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4...

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 125000 numbers

Test #10:

score: 0
Accepted
time: 32ms
memory: 9748kb

input:

100000
4 1
2 4
4 1
1 4
4 1
3 4
4 1
3 4
4 1
1 2
4 1
2 4
4 1
1 3
4 1
1 2
4 1
1 4
4 1
2 4
4 1
1 4
4 1
3 4
4 1
1 3
4 1
1 2
4 1
3 4
4 1
3 4
4 1
1 4
4 1
1 4
4 1
1 2
4 1
1 3
4 1
3 4
4 1
1 3
4 1
1 2
4 1
1 3
4 1
1 3
4 1
2 4
4 1
1 3
4 1
1 4
4 1
2 4
4 1
1 3
4 1
1 3
4 1
3 4
4 1
1 2
4 1
1 4
4 1
2 4
4 1
1 2
4 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 100000 numbers

Test #11:

score: 0
Accepted
time: 45ms
memory: 9852kb

input:

83333
4 2
1 2
1 3
4 2
1 4
2 4
4 2
3 4
1 3
4 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 71428 numbers

Test #13:

score: 0
Accepted
time: 42ms
memory: 9908kb

input:

62500
4 4
1 2
1 3
2 3
3 4
4 4
1 3
2 3
2 4
3 4
4 4
2 4
1 3
3 4
1 2
4 4
1 4
1 2
3 4
2 4
4 4
1 4
2 4
1 3
2 3
4 4
2 4
1 3
1 4
1 2
4 4
1 2
3 4
1 4
2 4
4 4
2 3
3 4
1 3
1 4
4 4
1 4
2 4
1 3
2 3
4 4
3 4
1 2
2 4
1 3
4 4
2 3
2 4
3 4
1 3
4 4
1 3
1 4
3 4
2 3
4 4
2 4
1 4
1 3
2 3
4 4
2 4
3 4
1 4
2 3
4 4
1 2
1 3
1 ...

output:

1
1
5
1
5
1
1
1
5
5
1
1
5
1
1
1
5
1
1
1
1
1
1
5
1
1
5
1
1
1
5
1
1
5
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
5
5
1
1
5
1
5
5
1
1
1
5
1
5
1
1
1
1
1
1
1
5
5
5
1
1
5
5
1
1
1
1
5
1
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
5
1
5
1
1
5
5
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
5
5
1
1
...

result:

ok 62500 numbers

Test #14:

score: 0
Accepted
time: 45ms
memory: 7756kb

input:

55555
4 5
1 3
2 4
2 3
1 4
3 4
4 5
2 4
3 4
1 4
2 3
1 3
4 5
1 2
3 4
1 4
2 3
1 3
4 5
2 4
1 4
1 3
2 3
3 4
4 5
3 4
1 2
1 3
2 4
2 3
4 5
1 2
1 3
3 4
1 4
2 4
4 5
1 3
1 4
2 3
3 4
2 4
4 5
1 3
1 2
3 4
2 4
1 4
4 5
1 3
2 4
3 4
1 2
2 3
4 5
1 3
3 4
1 2
2 3
1 4
4 5
1 3
1 4
3 4
1 2
2 3
4 5
1 3
2 4
1 4
2 3
1 2
4 5
3 ...

output:

5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
...

result:

ok 55555 numbers

Test #15:

score: 0
Accepted
time: 38ms
memory: 9924kb

input:

50000
4 6
1 3
2 4
1 4
3 4
1 2
2 3
4 6
1 3
1 4
1 2
3 4
2 4
2 3
4 6
1 4
2 3
2 4
3 4
1 3
1 2
4 6
2 4
2 3
1 2
3 4
1 4
1 3
4 6
1 3
1 4
3 4
2 4
1 2
2 3
4 6
2 3
2 4
3 4
1 2
1 3
1 4
4 6
1 3
2 3
3 4
1 4
2 4
1 2
4 6
1 4
2 4
1 3
3 4
1 2
2 3
4 6
3 4
1 4
1 3
1 2
2 3
2 4
4 6
2 4
2 3
3 4
1 3
1 4
1 2
4 6
1 4
1 3
2 ...

output:

25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
...

result:

ok 50000 numbers

Test #16:

score: 0
Accepted
time: 16ms
memory: 7860kb

input:

100000
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5...

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 100000 numbers

Test #17:

score: 0
Accepted
time: 29ms
memory: 9840kb

input:

83333
5 1
1 2
5 1
1 3
5 1
2 5
5 1
1 3
5 1
1 2
5 1
1 5
5 1
1 5
5 1
1 2
5 1
3 4
5 1
3 5
5 1
2 5
5 1
2 4
5 1
1 2
5 1
4 5
5 1
1 2
5 1
1 5
5 1
1 4
5 1
3 4
5 1
2 5
5 1
2 5
5 1
2 5
5 1
2 4
5 1
3 4
5 1
2 3
5 1
1 3
5 1
4 5
5 1
1 3
5 1
1 3
5 1
1 4
5 1
1 2
5 1
2 5
5 1
1 5
5 1
1 2
5 1
4 5
5 1
1 4
5 1
1 4
5 1
2 ...

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 83333 numbers

Test #18:

score: 0
Accepted
time: 39ms
memory: 9884kb

input:

71428
5 2
2 5
2 4
5 2
2 3
1 3
5 2
3 4
1 2
5 2
1 3
1 4
5 2
1 2
2 3
5 2
3 5
3 4
5 2
2 3
2 5
5 2
1 5
2 5
5 2
1 4
2 3
5 2
1 2
4 5
5 2
1 4
1 5
5 2
1 4
3 5
5 2
3 4
1 3
5 2
3 4
1 2
5 2
1 5
1 2
5 2
2 4
2 3
5 2
3 4
3 5
5 2
2 3
2 4
5 2
2 4
1 4
5 2
2 4
1 3
5 2
1 5
3 4
5 2
1 2
2 5
5 2
1 2
1 3
5 2
4 5
1 5
5 2
2 ...

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 71428 numbers

Test #19:

score: 0
Accepted
time: 21ms
memory: 9836kb

input:

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

result:

ok 55555 numbers

Test #21:

score: -100
Wrong Answer
time: 48ms
memory: 9804kb

input:

50000
5 5
2 4
2 5
1 4
1 2
4 5
5 5
1 2
3 5
2 5
3 4
1 4
5 5
2 4
3 4
2 3
1 5
3 5
5 5
3 4
3 5
2 3
1 5
2 4
5 5
2 4
3 4
1 2
2 5
1 3
5 5
1 2
2 4
1 3
2 5
2 3
5 5
4 5
3 5
2 4
1 2
3 4
5 5
1 3
1 5
2 4
3 5
1 4
5 5
1 3
2 5
2 4
1 4
4 5
5 5
2 3
1 5
3 5
1 4
3 4
5 5
2 3
2 5
4 5
3 5
1 5
5 5
3 4
2 5
2 4
1 3
1 2
5 5
2 ...

output:

5
1
1
1
5
1
1
1
1
5
1
5
1
1
5
1
5
1
1
1
1
5
1
1
1
5
5
1
5
1
5
5
5
1
1
5
5
5
1
5
5
5
1
5
1
5
5
5
1
1
1
1
1
1
5
1
1
1
5
5
5
1
5
1
1
1
1
5
1
5
1
1
5
5
5
5
1
1
1
5
1
1
1
1
1
1
5
5
5
1
1
1
5
5
5
1
1
5
1
5
1
1
5
1
5
5
1
1
1
5
5
5
5
5
1
5
5
1
1
5
5
5
5
5
1
1
1
1
1
5
5
1
5
5
1
1
5
5
1
5
1
1
5
5
5
5
5
1
1
1
...

result:

wrong answer 15th numbers differ - expected: '1', found: '5'