QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179037#3097. Shoppingznstz#1 128ms15100kbC++204.0kb2023-09-14 17:03:022024-07-04 02:00:11

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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