QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179044#3097. Shoppingznstz1 122ms15016kbC++204.0kb2023-09-14 17:08:512023-09-14 17:08:51

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

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

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: 9ms
memory: 3980kb

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

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: 9ms
memory: 4012kb

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: 14ms
memory: 4060kb

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

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: 3ms
memory: 3876kb

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: 3ms
memory: 4244kb

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

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

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: 6ms
memory: 4244kb

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: 10ms
memory: 4216kb

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

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: 4ms
memory: 3984kb

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: 9ms
memory: 3984kb

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: 3ms
memory: 4240kb

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: 3ms
memory: 3916kb

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: 9ms
memory: 3904kb

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: 9ms
memory: 3916kb

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: 9ms
memory: 3924kb

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

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: 6ms
memory: 3852kb

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

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

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: 4ms
memory: 4264kb

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: 0ms
memory: 3928kb

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: 107ms
memory: 14884kb

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: 115ms
memory: 15016kb

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: 119ms
memory: 14876kb

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: 122ms
memory: 14788kb

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