QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#791823#840. Just CountingUrdWA 41ms9896kbC++171.3kb2024-11-28 21:14:362024-11-28 21:14:36

详细

Test #1:

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

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: 41ms
memory: 9284kb

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: 26ms
memory: 8280kb

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

result:

ok 166666 numbers

Test #5:

score: 0
Accepted
time: 19ms
memory: 8428kb

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

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

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 26ms
memory: 8304kb

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: 15ms
memory: 8456kb

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: 20ms
memory: 8312kb

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: 18ms
memory: 8648kb

input:

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

result:

ok 71428 numbers

Test #13:

score: 0
Accepted
time: 26ms
memory: 9896kb

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: -100
Wrong Answer
time: 27ms
memory: 8388kb

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
1
5
5
5
5
5
5
5
1
1
5
1
5
5
5
5
1
5
1
5
5
5
5
1
5
1
5
5
5
1
1
1
5
5
1
5
1
5
1
1
1
5
5
5
1
5
1
1
5
1
5
5
1
5
5
1
1
1
5
1
1
5
1
1
5
5
1
5
1
1
1
5
1
1
1
1
1
5
5
5
5
5
5
5
1
5
1
1
5
5
5
1
1
5
1
5
1
1
5
1
5
5
1
1
5
1
1
1
1
1
1
5
5
5
5
1
1
1
5
5
1
1
1
5
5
5
1
1
1
5
1
1
1
5
1
1
5
5
1
1
1
1
1
1
1
1
1
5
1
...

result:

wrong answer 2nd numbers differ - expected: '5', found: '1'