QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179046#3097. Shoppingznstz1 61ms15080kbC++204.0kb2023-09-14 17:09:412023-09-14 17:09:42

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 10ms
memory: 3936kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #2:

score: 1
Accepted
time: 10ms
memory: 3796kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #3:

score: 1
Accepted
time: 14ms
memory: 3796kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #4:

score: 1
Accepted
time: 10ms
memory: 3928kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #5:

score: 1
Accepted
time: 10ms
memory: 3856kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #6:

score: 1
Accepted
time: 4ms
memory: 3752kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
1
1
1
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
1
1
1
0
1
1
0
0
0
0
0
0
0
1
1
1
0
1
0
1
1
1
1
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
0
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
0
1
1
0
1
0
1
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #7:

score: 1
Accepted
time: 8ms
memory: 3840kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
1
0
1
1
0
0
0
1
1
1
0
1
0
1
0
1
1
0
0
1
0
1
1
0
0
1
1
1
0
0
0
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
0
0
0
1
1
1
0
1
1
1
0
1
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #8:

score: 1
Accepted
time: 7ms
memory: 3828kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
0
0
0
1
1
1
1
0
0
0
1
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
1
0
1
1
0
1
0
1
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
1
0
1
0
0
0
1
1
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #9:

score: 1
Accepted
time: 4ms
memory: 3788kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
1
1
1
0
1
1
0
1
1
1
0
0
0
0
1
0
1
0
0
1
1
1
1
0
0
1
1
0
0
0
1
0
1
1
0
1
1
0
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
1
1
0
0
0
1
1
0
1
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #10:

score: 1
Accepted
time: 4ms
memory: 3780kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
1
0
0
0
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
0
0
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
1
1
1
0
0
0
0
1
0
1
0
1
1
0
0
0
0
0
1
1
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
0
1
0
1
0
1
1
1
0
0
0
1
1
0
0
1
1
1
1
0
1
1
0
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #11:

score: 1
Accepted
time: 4ms
memory: 3932kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
1
1
1
0
0
0
0
0
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
0
1
0
0
0
1
1
0
0
1
0
1
1
0
1
0
1
1
0
1
1
1
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
1
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #12:

score: 1
Accepted
time: 6ms
memory: 3800kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #13:

score: 1
Accepted
time: 4ms
memory: 3896kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #14:

score: 1
Accepted
time: 6ms
memory: 5836kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
1
1
1
1
0
1
0
1
1
0
0
1
1
0
1
1
1
1
0
0
0
1
1
1
0
1
0
0
0
1
0
1
0
1
0
1
1
1
0
0
0
0
1
0
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
1
0
1
1
1
0
0
0
1
1
0
1
1
1
1
0
0
0
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #15:

score: 1
Accepted
time: 4ms
memory: 3788kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
0
0
0
0
0
1
1
1
1
1
1
1
1
0
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
0
1
0
1
0
0
1
1
0
0
1
0
1
1
0
0
0
0
0
1
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
0
1
1
1
0
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #16:

score: 1
Accepted
time: 4ms
memory: 3796kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #17:

score: 1
Accepted
time: 8ms
memory: 3900kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #18:

score: 1
Accepted
time: 8ms
memory: 3780kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
1
1
0
1
0
0
0
1
1
0
0
0
1
0
0
1
1
1
0
0
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
0
1
0
0
1
0
1
0
0
1
0
1
0
0
0
0
1
1
0
0
1
1
1
1
1
0
0
0
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #19:

score: 1
Accepted
time: 8ms
memory: 3796kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
0
0
1
1
0
1
0
1
0
0
0
0
0
1
0
1
1
1
1
0
0
0
0
0
1
1
1
1
1
0
0
1
1
0
0
1
1
0
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #20:

score: 1
Accepted
time: 4ms
memory: 3744kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
1
1
1
0
1
0
0
0
0
1
1
1
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
1
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
0
0
1
0
1
1
1
0
1
0
0
1
0
1
1
0
1
1
0
1
1
0
1
1
1
0
1
1
0
0
1
1
0
0
1
1
1
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #21:

score: 9
Accepted
time: 0ms
memory: 3880kb

input:

0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
1
1
0
0
1
1
1
0
0
0
0
1
0
1
0
1
1
1
0
0
1
1
1
1
1
0
1
1
1
0
1
0
0
1
0
0
0
1
0
0
1
0
0
1
1
1
1
0
1
0
0
1
0
0
1
0
1
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
0
0
0
1
0
1
0
1
1
0
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
0
1
1
1
0
1
0
0
1
1
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #22:

score: 9
Accepted
time: 0ms
memory: 3744kb

input:

1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
0
1
0
0
1
0
0
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
0
1
0
0
0
0
1
1
0
0
0
1
0
1
1
0
1
1
1
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #23:

score: 9
Accepted
time: 3ms
memory: 3716kb

input:

1
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
0
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
1
1
1
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
1
0
0
1
1
0
0
1
0
0
1
1
1
1
0
0
1
0
0
1
1
1
1
0
0
0
0
0
1
1
1
0
1
0
1
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
1
0
1
0
0
0
0
0
0
1
0
1
1
1
1
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #24:

score: 9
Accepted
time: 0ms
memory: 3724kb

input:

0
0
1
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
1
0
1
0
1
1
1
1
0
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
0
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #25:

score: 9
Accepted
time: 8ms
memory: 3944kb

input:

0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
1
1
1
0
0
0
1
0
0
0
0
0
1
0
1
1
1
0
1
1
0
1
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
1
1
0
1
0
0
1
1
0
0
1
1
1
0
0
1
1
0
1
0
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
0
0
0
1
0
0
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
0
1
1
0
0
1
1
1
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #26:

score: 0
Wrong Answer
time: 2ms
memory: 3756kb

input:

1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
0
1
0
1
0
1
1
0
0
0
1
1
1
1
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0...

input:


output:

Wrong Answer [2]

result:

wrong answer 

Subtask #3:

score: 0
Wrong Answer

Test #38:

score: 8.195
Acceptable Answer
time: 61ms
memory: 14912kb

input:

0
0
1
1
0
0
0
0
1
1
0
1
0
0
1
1
1
0
-1
-1
-1

output:

-1
1
1
1
1
1
0
0
1
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
1
0
1
0
0
1
0
1
0
0
1
0
1
1
0
1
0
0
1
0
1
1
1
1
0
1
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
1
0
1
0
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #39:

score: 8.195
Acceptable Answer
time: 60ms
memory: 15080kb

input:

0
0
0
1
0
0
1
1
1
1
1
0
1
0
0
1
0
1
-1
-1
-1

output:

-1
1
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
1
1
1
0
1
1
1
0
0
1
0
0
0
1
0
1
0
1
1
1
1
1
0
0
0
1
0
1
0
1
0
0
0
1...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #40:

score: 8.195
Acceptable Answer
time: 55ms
memory: 14788kb

input:

1
0
1
0
0
1
0
0
0
0
1
1
1
0
1
1
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
1
0
1
0
0
1
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
0
0
0
0
0
0
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #41:

score: 0
Wrong Answer
time: 59ms
memory: 14812kb

input:

1
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
0
0
1
0
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
0
0
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
0
0
0
1
0
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0...

input:


output:

Wrong Answer [2]

result:

wrong answer