QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#388915#4884. Battleship: New RulesQiulyAC ✓50ms12028kbC++171.8kb2024-04-13 21:26:492024-04-13 21:26:50

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4048kb

input:

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

output:

! -1 -1
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
! 2 2

result:

ok max_C=2.00, avg_C=1.00 (2 test cases)

Test #2:

score: 0
Accepted
time: 4ms
memory: 3756kb

input:

100
4
0
1
0
0
0
0
1
0
1
4
0
1
0
0
0
0
1
0
1
4
1
0
0
0
0
0
0
1
1
4
1
0
0
0
0
0
0
1
1
4
0
1
0
0
0
0
1
0
1
4
0
1
0
0
0
0
1
0
1
4
0
1
0
0
0
0
1
0
1
4
1
0
0
0
0
0
0
1
1
4
1
0
0
0
0
0
0
1
1
4
1
0
0
0
0
0
0
1
1
4
1
0
0
0
0
0
0
1
1
4
0
1
0
0
0
0
1
0
1
4
1
0
0
0
0
0
0
1
1
4
0
1
0
0
0
0
1
0
1
4
0
1
0
0
0
0
1
...

output:

? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
! 2 2
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
! 2 2
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
! 2 2
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
! 2 2
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
! 2 2
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
...

result:

ok max_C=2.00, avg_C=2.00 (100 test cases)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

100
10
0
1
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
1
0
1
1
1
0
0
0
1
0
1
0
0
1
10
1
1
0
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
1
1
0
0
1
0
1
0
0
0
1
0
0
0
1
0
1
10
0
1
0
1
0
0
0
0
1
0
1
0
0
0
1
1
0
0
1
1
1
10
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
1
0
0
0
0
0
0
1
1
10
1
1
0
0
0
1
0...

output:

? 5 1
? 6 1
? 5 2
? 6 2
? 5 3
? 6 3
? 5 4
? 6 4
? 5 5
? 6 5
? 5 6
? 6 6
? 5 7
? 6 7
? 5 8
? 6 8
? 5 9
? 6 9
? 5 10
? 6 10
? 1 5
? 1 6
? 2 5
? 2 6
? 3 5
? 3 6
? 4 5
? 4 6
? 2 1
? 3 1
? 2 2
? 3 2
? 2 3
? 3 3
? 2 4
? 3 4
? 4 2
? 4 3
! 4 2
? 5 1
? 6 1
? 5 2
? 6 2
? 5 3
? 6 3
? 5 4
? 6 4
? 5 5
? 6 5
? 5 ...

result:

ok max_C=3.90, avg_C=3.45 (100 test cases)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

100
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
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...

result:

ok max_C=0.00, avg_C=0.00 (100 test cases)

Test #5:

score: 0
Accepted
time: 24ms
memory: 3728kb

input:

100
50
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
1
1
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1...

output:

? 25 1
? 26 1
? 25 2
? 26 2
? 25 3
? 26 3
? 25 4
? 26 4
? 25 5
? 26 5
? 25 6
? 26 6
? 25 7
? 26 7
? 25 8
? 26 8
? 25 9
? 26 9
? 25 10
? 26 10
? 25 11
? 26 11
? 25 12
? 26 12
? 25 13
? 26 13
? 25 14
? 26 14
? 25 15
? 26 15
? 25 16
? 26 16
? 25 17
? 26 17
? 25 18
? 26 18
? 25 19
? 26 19
? 25 20
? 26 2...

result:

ok max_C=5.36, avg_C=5.01 (100 test cases)

Test #6:

score: 0
Accepted
time: 12ms
memory: 4196kb

input:

100
31
1
23
1
62
1
1
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
0
1
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1...

output:

! -1 -1
! -1 -1
? 31 1
? 32 1
? 31 2
? 32 2
? 31 3
? 32 3
? 31 4
? 32 4
? 31 5
? 32 5
? 31 6
? 32 6
? 31 7
? 32 7
? 31 8
? 32 8
? 31 9
? 32 9
? 31 10
? 32 10
? 31 11
? 32 11
? 31 12
? 32 12
? 31 13
? 32 13
? 31 14
? 32 14
? 31 15
? 32 15
? 31 16
? 32 16
? 31 17
? 32 17
? 31 18
? 32 18
? 31 19
? 32 1...

result:

ok max_C=5.75, avg_C=2.24 (100 test cases)

Test #7:

score: 0
Accepted
time: 14ms
memory: 4144kb

input:

100
50
1
1
0
0
0
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
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
0
0
1...

output:

? 25 1
? 26 1
? 25 2
? 26 2
? 25 3
? 26 3
? 25 4
? 26 4
? 25 5
? 26 5
? 25 6
? 26 6
? 25 7
? 26 7
? 25 8
? 26 8
? 25 9
? 26 9
? 25 10
? 26 10
? 25 11
? 26 11
? 25 12
? 26 12
? 25 13
? 26 13
? 25 14
? 26 14
? 25 15
? 26 15
? 25 16
? 26 16
? 25 17
? 26 17
? 25 18
? 26 18
? 25 19
? 26 19
? 25 20
? 26 2...

result:

ok max_C=5.36, avg_C=5.23 (100 test cases)

Test #8:

score: 0
Accepted
time: 36ms
memory: 3876kb

input:

100
50
1
1
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
0
1
0
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1...

output:

? 25 1
? 26 1
? 25 2
? 26 2
? 25 3
? 26 3
? 25 4
? 26 4
? 25 5
? 26 5
? 25 6
? 26 6
? 25 7
? 26 7
? 25 8
? 26 8
? 25 9
? 26 9
? 25 10
? 26 10
? 25 11
? 26 11
? 25 12
? 26 12
? 25 13
? 26 13
? 25 14
? 26 14
? 25 15
? 26 15
? 25 16
? 26 16
? 25 17
? 26 17
? 25 18
? 26 18
? 25 19
? 26 19
? 25 20
? 26 2...

result:

ok max_C=5.36, avg_C=5.12 (100 test cases)

Test #9:

score: 0
Accepted
time: 35ms
memory: 5812kb

input:

10
500
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0...

output:

? 250 1
? 251 1
? 250 2
? 251 2
? 250 3
? 251 3
? 250 4
? 251 4
? 250 5
? 251 5
? 250 6
? 251 6
? 250 7
? 251 7
? 250 8
? 251 8
? 250 9
? 251 9
? 250 10
? 251 10
? 250 11
? 251 11
? 250 12
? 251 12
? 250 13
? 251 13
? 250 14
? 251 14
? 250 15
? 251 15
? 250 16
? 251 16
? 250 17
? 251 17
? 250 18
? 2...

result:

ok max_C=5.89, avg_C=5.85 (10 test cases)

Test #10:

score: 0
Accepted
time: 15ms
memory: 11360kb

input:

10
597
1
1000
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
1
0
0
0
1
0
1
0
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
...

output:

! -1 -1
? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 50...

result:

ok max_C=5.93, avg_C=3.45 (10 test cases)

Test #11:

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

input:

5
999
1
999
1
999
1
999
1
999
1

output:

! -1 -1
! -1 -1
! -1 -1
! -1 -1
! -1 -1

result:

ok max_C=0.00, avg_C=0.00 (5 test cases)

Test #12:

score: 0
Accepted
time: 48ms
memory: 11960kb

input:

5
1000
1
1
0
0
0
1
0
0
1
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.93, avg_C=5.92 (5 test cases)

Test #13:

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

input:

5
1000
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.92, avg_C=5.92 (5 test cases)

Test #14:

score: 0
Accepted
time: 37ms
memory: 11960kb

input:

5
1000
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.94, avg_C=5.64 (5 test cases)

Test #15:

score: 0
Accepted
time: 50ms
memory: 11616kb

input:

5
1000
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.93, avg_C=5.92 (5 test cases)

Test #16:

score: 0
Accepted
time: 20ms
memory: 12028kb

input:

5
1000
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.93, avg_C=5.92 (5 test cases)

Test #17:

score: 0
Accepted
time: 24ms
memory: 11660kb

input:

5
1000
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.93, avg_C=5.91 (5 test cases)

Test #18:

score: 0
Accepted
time: 22ms
memory: 11664kb

input:

5
1000
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.94, avg_C=5.90 (5 test cases)

Test #19:

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

input:

5
1000
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.94, avg_C=5.92 (5 test cases)

Test #20:

score: 0
Accepted
time: 43ms
memory: 11680kb

input:

5
1000
1
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0...

output:

? 500 1
? 501 1
? 500 2
? 501 2
? 500 3
? 501 3
? 500 4
? 501 4
? 500 5
? 501 5
? 500 6
? 501 6
? 500 7
? 501 7
? 500 8
? 501 8
? 500 9
? 501 9
? 500 10
? 501 10
? 500 11
? 501 11
? 500 12
? 501 12
? 500 13
? 501 13
? 500 14
? 501 14
? 500 15
? 501 15
? 500 16
? 501 16
? 500 17
? 501 17
? 500 18
? 5...

result:

ok max_C=5.94, avg_C=5.93 (5 test cases)