QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#619610#8239. Mysterious TreeZhaoZiLongAC ✓5ms3736kbC++173.2kb2024-10-07 14:47:222024-10-07 14:47:23

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok Correct (2 test cases)

Test #2:

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

input:

87
13
0
1
0
0
0
0
0
1
1
15
0
0
1
0
0
0
0
0
1
1
7
1
0
0
0
1
1
15
1
0
1
19
0
0
0
0
0
0
0
0
1
0
1
1
20
1
0
0
0
0
0
0
0
0
0
0
0
7
0
1
0
0
1
1
20
0
0
0
0
0
1
0
0
0
0
0
1
1
17
0
0
0
0
0
0
0
0
0
11
0
0
0
0
1
0
0
14
1
0
1
13
0
0
0
0
0
0
0
18
0
0
0
0
0
0
1
0
0
0
1
1
14
0
0
0
1
0
0
0
1
1
20
0
0
0
0
0
0
1
0
0
...

output:

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

result:

ok Correct (87 test cases)

Test #3:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

135
9
0
1
1
6
0
1
0
0
0
11
0
0
0
0
0
0
4
0
0
10
0
1
0
0
0
0
1
1
9
0
0
1
0
0
1
1
9
0
0
0
1
0
1
1
6
1
1
9
0
0
1
0
0
1
1
11
1
0
0
1
4
0
1
0
1
0
4
1
0
1
1
8
1
1
5
0
1
0
0
7
0
0
1
1
0
11
0
1
0
0
0
0
1
1
4
1
0
1
1
6
1
0
0
1
1
9
0
0
0
0
1
1
1
4
0
1
1
1
8
0
0
0
0
9
0
0
0
1
0
1
1
7
0
1
0
0
0
4
1
0
1
1
8
1
0
...

output:

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

result:

ok Correct (135 test cases)

Test #4:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

136
8
1
0
0
0
0
1
1
5
0
1
1
1
11
0
0
0
0
0
0
10
0
0
0
1
0
0
0
6
0
1
0
0
0
9
0
0
0
1
0
1
1
7
0
0
1
1
1
10
0
0
0
0
1
0
1
1
7
0
0
1
0
1
1
9
0
0
0
0
1
1
1
5
1
0
0
1
1
7
1
1
10
0
0
0
0
1
0
1
1
6
1
1
6
1
1
6
0
0
1
0
1
1
10
0
0
1
0
0
1
1
9
0
0
0
0
1
1
1
5
0
0
1
1
1
6
0
1
0
0
1
1
4
1
1
5
0
0
1
1
1
4
0
1
1
1...

output:

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

result:

ok Correct (136 test cases)

Test #5:

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

input:

5
100
0
0
0
0
0
0
0
0
0
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
758
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 100
? 2 99
? 3 98
? 4 97
? 5 96
? 6 95
? 7 94
? 8 93
? 9 92
? 10 91
? 11 90
? 12 89
? 13 88
? 14 87
? 15 86
? 16 85
? 17 84
? 18 83
? 19 82
? 20 81
? 21 80
? 22 79
? 23 78
? 24 77
? 25 76
? 26 75
? 27 74
? 28 73
? 29 72
? 30 71
? 31 70
? 32 69
? 33 68
? 34 67
? 35 66
? 36 65
? 37 64
? 38 63
? 39...

result:

ok Correct (5 test cases)

Test #6:

score: 0
Accepted
time: 2ms
memory: 3656kb

input:

7
147
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
801
0
0
0
0
0
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
...

output:

? 1 147
? 2 146
? 3 145
? 4 144
? 5 143
? 6 142
? 7 141
? 8 140
? 9 139
? 10 138
? 11 137
? 12 136
? 13 135
? 14 134
? 15 133
? 16 132
? 17 131
? 18 130
? 19 129
? 20 128
? 21 127
? 22 126
? 23 125
? 24 124
? 25 123
? 26 122
? 27 121
? 28 120
? 29 119
? 30 118
? 31 117
? 32 116
? 33 115
? 34 114
? 3...

result:

ok Correct (7 test cases)

Test #7:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

160
4
0
0
9
0
0
0
0
0
7
0
0
0
1
1
1
4
0
0
9
0
0
0
0
1
1
1
9
0
0
0
0
1
1
1
6
0
0
1
0
1
1
7
0
0
0
1
1
1
4
0
0
6
0
0
1
0
1
1
4
0
0
5
0
0
1
1
1
7
0
0
0
1
1
1
4
0
1
0
1
1
7
0
0
0
0
6
0
0
0
9
0
0
0
0
0
9
0
0
0
0
0
4
0
0
4
0
0
4
0
0
5
0
0
1
1
1
9
0
0
0
0
0
6
0
0
0
9
0
0
0
0
0
5
0
0
1
1
1
6
0
0
0
5
0
0
0
9
...

output:

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

result:

ok Correct (160 test cases)

Test #8:

score: 0
Accepted
time: 5ms
memory: 3616kb

input:

117
6
0
0
0
7
0
0
0
0
11
0
0
0
0
0
1
1
1
4
0
0
11
0
0
0
0
0
0
5
0
0
1
1
1
10
0
0
0
0
0
9
0
0
0
0
1
1
1
10
0
0
0
0
1
0
1
1
11
0
0
0
0
0
0
9
0
0
0
0
0
13
0
0
0
0
0
0
0
11
0
0
0
0
0
0
13
0
0
0
0
0
0
0
8
0
0
0
1
0
1
1
13
0
0
0
0
0
0
0
11
0
0
0
0
0
1
1
1
11
0
0
0
0
0
0
11
0
0
0
0
0
0
8
0
0
0
0
6
0
0
0
9
...

output:

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

result:

ok Correct (117 test cases)

Test #9:

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

input:

99
14
0
0
0
0
0
0
1
0
1
1
6
0
0
1
0
1
1
13
0
0
0
0
0
0
0
4
0
0
14
0
0
0
0
0
0
0
11
0
0
0
0
0
0
11
0
0
0
0
0
0
11
0
0
0
0
0
1
1
1
15
0
0
0
0
0
0
0
1
1
1
4
0
0
12
0
0
0
0
0
0
14
0
0
0
0
0
0
1
0
1
1
13
0
0
0
0
0
0
1
1
1
9
0
0
0
0
1
1
1
8
0
0
0
0
7
0
0
0
0
7
0
0
0
1
1
1
4
0
0
8
0
0
0
1
0
1
1
10
0
0
0
0
...

output:

? 1 14
? 2 13
? 3 12
? 4 11
? 5 10
? 6 9
? 7 8
? 7 1
? 8 1
? 8 2
! 2
? 1 6
? 2 5
? 3 4
? 3 1
? 4 1
? 4 2
! 2
? 1 13
? 2 12
? 3 11
? 4 10
? 5 9
? 6 8
? 7 1
! 1
? 1 4
? 2 3
! 1
? 1 14
? 2 13
? 3 12
? 4 11
? 5 10
? 6 9
? 7 8
! 1
? 1 11
? 2 10
? 3 9
? 4 8
? 5 7
? 6 1
! 1
? 1 11
? 2 10
? 3 9
? 4 8
? 5 7
...

result:

ok Correct (99 test cases)

Test #10:

score: 0
Accepted
time: 2ms
memory: 3672kb

input:

84
18
0
0
0
0
0
0
0
0
0
14
0
0
0
0
0
0
0
17
0
0
0
0
0
0
0
0
1
1
1
13
0
0
0
0
0
0
0
11
0
0
0
0
0
1
1
1
7
0
0
0
0
14
0
0
0
0
0
0
0
12
0
0
0
0
0
0
17
0
0
0
0
0
0
0
0
1
1
1
6
0
0
0
9
0
0
0
0
0
10
0
0
0
0
1
0
1
1
5
0
0
1
1
1
4
0
0
6
0
0
0
15
0
0
0
0
0
0
0
0
4
0
0
17
0
0
0
0
0
0
0
0
1
1
1
12
0
0
0
0
0
0
1...

output:

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

result:

ok Correct (84 test cases)

Test #11:

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

input:

23
27
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
12
0
0
0
0
0
0
93
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
100
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
6
0
0
0
59
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 27
? 2 26
? 3 25
? 4 24
? 5 23
? 6 22
? 7 21
? 8 20
? 9 19
? 10 18
? 11 17
? 12 16
? 13 15
? 14 1
? 14 27
? 14 2
! 2
? 1 12
? 2 11
? 3 10
? 4 9
? 5 8
? 6 7
! 1
? 1 93
? 2 92
? 3 91
? 4 90
? 5 89
? 6 88
? 7 87
? 8 86
? 9 85
? 10 84
? 11 83
? 12 82
? 13 81
? 14 80
? 15 79
? 16 78
? 17 77
? 18 76
?...

result:

ok Correct (23 test cases)

Test #12:

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

input:

20
39
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
44
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
85
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
94
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 39
? 2 38
? 3 37
? 4 36
? 5 35
? 6 34
? 7 33
? 8 32
? 9 31
? 10 30
? 11 29
? 12 28
? 13 27
? 14 26
? 15 25
? 16 24
? 17 23
? 18 22
? 19 21
? 3 1
? 37 1
? 37 20
! 2
? 1 44
? 2 43
? 3 42
? 4 41
? 5 40
? 6 39
? 7 38
? 8 37
? 9 36
? 10 35
? 11 34
? 12 33
? 13 32
? 14 31
? 15 30
? 16 29
? 17 28
? 18 ...

result:

ok Correct (20 test cases)

Test #13:

score: 0
Accepted
time: 3ms
memory: 3656kb

input:

9
69
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
189
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
72
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 69
? 2 68
? 3 67
? 4 66
? 5 65
? 6 64
? 7 63
? 8 62
? 9 61
? 10 60
? 11 59
? 12 58
? 13 57
? 14 56
? 15 55
? 16 54
? 17 53
? 18 52
? 19 51
? 20 50
? 21 49
? 22 48
? 23 47
? 24 46
? 25 45
? 26 44
? 27 43
? 28 42
? 29 41
? 30 40
? 31 39
? 32 38
? 33 37
? 34 36
? 35 1
! 1
? 1 189
? 2 188
? 3 187
? ...

result:

ok Correct (9 test cases)

Test #14:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

6
243
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
181
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 243
? 2 242
? 3 241
? 4 240
? 5 239
? 6 238
? 7 237
? 8 236
? 9 235
? 10 234
? 11 233
? 12 232
? 13 231
? 14 230
? 15 229
? 16 228
? 17 227
? 18 226
? 19 225
? 20 224
? 21 223
? 22 222
? 23 221
? 24 220
? 25 219
? 26 218
? 27 217
? 28 216
? 29 215
? 30 214
? 31 213
? 32 212
? 33 211
? 34 210
? 3...

result:

ok Correct (6 test cases)

Test #15:

score: 0
Accepted
time: 3ms
memory: 3588kb

input:

4
613
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 613
? 2 612
? 3 611
? 4 610
? 5 609
? 6 608
? 7 607
? 8 606
? 9 605
? 10 604
? 11 603
? 12 602
? 13 601
? 14 600
? 15 599
? 16 598
? 17 597
? 18 596
? 19 595
? 20 594
? 21 593
? 22 592
? 23 591
? 24 590
? 25 589
? 26 588
? 27 587
? 28 586
? 29 585
? 30 584
? 31 583
? 32 582
? 33 581
? 34 580
? 3...

result:

ok Correct (4 test cases)

Test #16:

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

input:

146
6
1
1
9
1
1
4
1
0
1
1
9
1
0
0
0
1
1
7
1
1
6
1
0
0
1
1
5
1
1
9
1
0
0
0
1
1
7
1
1
4
1
0
1
1
9
1
1
5
1
0
1
1
4
1
1
9
1
0
0
0
1
1
5
1
1
4
1
1
9
1
1
6
1
1
5
1
1
9
1
1
6
1
1
5
1
1
7
1
1
5
1
1
5
1
1
5
1
1
7
1
0
0
1
1
4
1
1
4
1
1
6
1
1
8
1
1
7
1
1
5
1
1
9
1
1
7
1
0
0
1
1
8
1
1
6
1
1
8
1
1
8
1
1
9
1
0
0
...

output:

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

result:

ok Correct (146 test cases)

Test #17:

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

input:

117
4
1
1
4
1
0
1
1
12
1
0
0
0
0
0
1
1
7
1
0
0
1
1
12
1
1
9
1
0
0
0
1
1
10
1
0
0
0
0
1
1
13
1
1
11
1
0
0
0
0
1
1
9
1
1
12
1
0
0
0
0
0
1
1
11
1
1
4
1
1
10
1
0
0
0
0
1
1
5
1
0
1
1
5
1
0
1
1
5
1
0
1
1
4
1
1
4
1
1
7
1
1
4
1
1
8
1
1
7
1
1
6
1
1
7
1
1
13
1
1
10
1
0
0
0
0
1
1
12
1
0
0
0
0
0
1
1
9
1
1
4
1
1...

output:

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

result:

ok Correct (117 test cases)

Test #18:

score: 0
Accepted
time: 2ms
memory: 3652kb

input:

105
7
1
1
11
1
1
13
1
1
12
1
1
6
1
1
10
1
0
0
0
0
1
1
7
1
1
4
1
1
13
1
0
0
0
0
0
1
1
13
1
0
0
0
0
0
1
1
14
1
1
5
1
1
6
1
0
0
1
1
4
1
0
1
1
6
1
1
6
1
1
10
1
0
0
0
0
1
1
15
1
1
6
1
1
9
1
1
13
1
1
15
1
0
0
0
0
0
0
1
1
5
1
0
1
1
11
1
1
6
1
1
7
1
1
10
1
1
15
1
1
12
1
1
7
1
0
0
1
1
12
1
1
12
1
0
0
0
0
0
1...

output:

? 1 7
? 2 6
! 1
? 1 11
? 2 10
! 1
? 1 13
? 2 12
! 1
? 1 12
? 2 11
! 1
? 1 6
? 2 5
! 1
? 1 10
? 2 9
? 3 8
? 4 7
? 5 6
? 1 2
? 1 3
! 2
? 1 7
? 2 6
! 1
? 1 4
? 2 3
! 1
? 1 13
? 2 12
? 3 11
? 4 10
? 5 9
? 6 8
? 1 2
? 1 7
! 2
? 1 13
? 2 12
? 3 11
? 4 10
? 5 9
? 6 8
? 1 2
? 1 7
! 2
? 1 14
? 2 13
! 1
? 1 5...

result:

ok Correct (105 test cases)

Test #19:

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

input:

86
12
1
0
0
0
0
0
1
1
17
1
1
7
1
0
0
1
1
6
1
1
13
1
0
0
0
0
0
1
1
5
1
0
1
1
16
1
1
6
1
0
0
1
1
10
1
1
18
1
1
4
1
1
19
1
1
14
1
0
0
0
0
0
0
1
1
13
1
0
0
0
0
0
1
1
4
1
0
1
1
5
1
1
8
1
1
13
1
1
15
1
0
0
0
0
0
0
1
1
7
1
1
20
1
1
20
1
1
5
1
1
6
1
1
5
1
1
15
1
1
12
1
1
9
1
0
0
0
1
1
17
1
1
19
1
0
0
0
0
0
...

output:

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

result:

ok Correct (86 test cases)

Test #20:

score: 0
Accepted
time: 3ms
memory: 3656kb

input:

20
53
1
1
61
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
96
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
1
1
60
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
25
1
1
18
1
0
0
0
0
0
0
0
0
1
1
24
1
1
73
1
1
76
1
1
...

output:

? 1 53
? 2 52
! 1
? 1 61
? 2 60
? 3 59
? 4 58
? 5 57
? 6 56
? 7 55
? 8 54
? 9 53
? 10 52
? 11 51
? 12 50
? 13 49
? 14 48
? 15 47
? 16 46
? 17 45
? 18 44
? 19 43
? 20 42
? 21 41
? 22 40
? 23 39
? 24 38
? 25 37
? 26 36
? 27 35
? 28 34
? 29 33
? 30 32
? 1 2
? 1 31
! 2
? 1 96
? 2 95
? 3 94
? 4 93
? 5 92...

result:

ok Correct (20 test cases)

Test #21:

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

input:

9
273
1
1
54
1
1
234
1
1
256
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
1
1
70
1
0
0
0
...

output:

? 1 273
? 2 272
! 1
? 1 54
? 2 53
! 1
? 1 234
? 2 233
! 1
? 1 256
? 2 255
? 3 254
? 4 253
? 5 252
? 6 251
? 7 250
? 8 249
? 9 248
? 10 247
? 11 246
? 12 245
? 13 244
? 14 243
? 15 242
? 16 241
? 17 240
? 18 239
? 19 238
? 20 237
? 21 236
? 22 235
? 23 234
? 24 233
? 25 232
? 26 231
? 27 230
? 28 229...

result:

ok Correct (9 test cases)

Test #22:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

12
92
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
1
1
50
1
1
395
1
1
152
1
1
31
1
1
183
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
...

output:

? 1 92
? 2 91
? 3 90
? 4 89
? 5 88
? 6 87
? 7 86
? 8 85
? 9 84
? 10 83
? 11 82
? 12 81
? 13 80
? 14 79
? 15 78
? 16 77
? 17 76
? 18 75
? 19 74
? 20 73
? 21 72
? 22 71
? 23 70
? 24 69
? 25 68
? 26 67
? 27 66
? 28 65
? 29 64
? 30 63
? 31 62
? 32 61
? 33 60
? 34 59
? 35 58
? 36 57
? 37 56
? 38 55
? 39 ...

result:

ok Correct (12 test cases)

Test #23:

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

input:

5
957
1
1
14
1
1
7
1
0
0
1
1
10
1
0
0
0
0
1
1
11
1
1

output:

? 1 957
? 2 956
! 1
? 1 14
? 2 13
! 1
? 1 7
? 2 6
? 3 5
? 1 2
? 1 4
! 2
? 1 10
? 2 9
? 3 8
? 4 7
? 5 6
? 1 2
? 1 3
! 2
? 1 11
? 2 10
! 1

result:

ok Correct (5 test cases)

Test #24:

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

input:

81
11
1
1
20
1
0
0
0
0
0
0
0
0
0
1
1
5
1
0
0
1
1
16
0
0
0
0
0
0
1
0
0
0
19
1
0
0
0
0
0
0
0
0
1
1
17
1
0
0
0
0
0
0
0
0
1
1
12
1
1
4
1
1
13
1
0
0
0
1
20
0
1
0
0
0
0
0
0
0
0
0
1
1
10
1
1
20
1
1
8
1
0
1
5
1
1
11
0
1
0
1
17
1
1
9
0
1
1
13
1
0
0
0
0
0
0
1
1
19
0
0
0
0
1
0
0
0
0
0
1
1
13
1
1
17
0
0
0
0
0
0...

output:

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

result:

ok Correct (81 test cases)

Test #25:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

24
43
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
87
1
1
19
1
0
1
23
0
0
0
0
0
1
0
0
0
1
13
1
0
0
1
75
1
1
13
0
0
0
0
0
1
0
1
1
85
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
1
1
31
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
24
1
1
68
0
0
1
1
94
1
0
0
0
0
0
0
0
0
0...

output:

? 1 43
? 2 42
? 3 41
? 4 40
? 5 39
? 6 38
? 7 37
? 8 36
? 9 35
? 10 34
? 11 33
? 12 32
? 13 31
? 14 30
? 15 29
? 16 28
? 17 27
? 18 26
? 19 25
? 20 24
? 21 23
? 1 2
? 1 22
! 2
? 1 87
? 2 86
! 1
? 1 19
? 2 18
? 3 17
! 1
? 1 23
? 2 22
? 3 21
? 4 20
? 5 19
? 6 18
? 7 17
? 8 16
? 9 15
? 10 14
! 1
? 1 13...

result:

ok Correct (24 test cases)

Test #26:

score: 0
Accepted
time: 5ms
memory: 3712kb

input:

9
35
0
0
0
0
1
0
0
1
122
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
1
1
167
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 35
? 2 34
? 3 33
? 4 32
? 5 31
? 6 30
? 7 29
? 8 28
! 1
? 1 122
? 2 121
? 3 120
? 4 119
? 5 118
? 6 117
? 7 116
? 8 115
? 9 114
? 10 113
? 11 112
? 12 111
? 13 110
? 14 109
? 15 108
? 16 107
? 17 106
? 18 105
? 19 104
? 20 103
? 21 102
? 22 101
? 23 100
? 24 99
? 25 98
? 26 97
? 27 96
? 28 95
? ...

result:

ok Correct (9 test cases)

Test #27:

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

input:

8
481
0
0
0
0
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
...

output:

? 1 481
? 2 480
? 3 479
? 4 478
? 5 477
? 6 476
? 7 475
? 8 474
? 9 473
? 10 472
? 11 471
? 12 470
? 13 469
? 14 468
? 15 467
? 16 466
? 17 465
? 18 464
? 19 463
? 20 462
? 21 461
? 22 460
? 23 459
? 24 458
? 25 457
? 26 456
? 27 455
? 28 454
? 29 453
? 30 452
? 31 451
? 32 450
? 33 449
? 34 448
? 3...

result:

ok Correct (8 test cases)

Test #28:

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

input:

10
510
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
222
1
1
115
0
0
1
1
20
0
1
0
0
0
0
0
0
0
0
0
1
1
37
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
10
0
0
1
0
0
0
0
19
1
0
0
0
0
0
0
0
0
1
1
22
0
1
0
1
36
1
0
1
7
0
0
0
1
0

output:

? 1 510
? 2 509
? 3 508
? 4 507
? 5 506
? 6 505
? 7 504
? 8 503
? 9 502
? 10 501
? 11 500
? 12 499
? 13 498
? 14 497
? 15 496
? 16 495
? 17 494
? 18 493
? 19 492
? 20 491
? 21 490
? 22 489
? 23 488
? 24 487
? 25 486
? 26 485
? 27 484
? 28 483
? 29 482
? 30 481
? 31 480
? 32 479
? 33 478
? 34 477
? 3...

result:

ok Correct (10 test cases)

Test #29:

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

input:

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

output:

? 1 1000
? 2 999
? 3 998
? 4 997
? 5 996
? 6 995
? 7 994
? 8 993
? 9 992
? 10 991
? 11 990
? 12 989
? 13 988
? 14 987
? 15 986
? 16 985
? 17 984
? 18 983
? 19 982
? 20 981
? 21 980
? 22 979
? 23 978
? 24 977
? 25 976
? 26 975
? 27 974
? 28 973
? 29 972
? 30 971
? 31 970
? 32 969
? 33 968
? 34 967
? ...

result:

ok Correct (1 test case)

Test #30:

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

input:

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

output:

? 1 500
? 2 499
? 3 498
? 4 497
? 5 496
? 6 495
? 7 494
? 8 493
? 9 492
? 10 491
? 11 490
? 12 489
? 13 488
? 14 487
? 15 486
? 16 485
? 17 484
? 18 483
? 19 482
? 20 481
? 21 480
? 22 479
? 23 478
? 24 477
? 25 476
? 26 475
? 27 474
? 28 473
? 29 472
? 30 471
? 31 470
? 32 469
? 33 468
? 34 467
? 3...

result:

ok Correct (2 test cases)

Test #31:

score: 0
Accepted
time: 2ms
memory: 3736kb

input:

4
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 250
? 2 249
? 3 248
? 4 247
? 5 246
? 6 245
? 7 244
? 8 243
? 9 242
? 10 241
? 11 240
? 12 239
? 13 238
? 14 237
? 15 236
? 16 235
? 17 234
? 18 233
? 19 232
? 20 231
? 21 230
? 22 229
? 23 228
? 24 227
? 25 226
? 26 225
? 27 224
? 28 223
? 29 222
? 30 221
? 31 220
? 32 219
? 33 218
? 34 217
? 3...

result:

ok Correct (4 test cases)

Test #32:

score: 0
Accepted
time: 5ms
memory: 3592kb

input:

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

output:

? 1 1000
? 2 999
? 3 998
? 4 997
? 5 996
? 6 995
? 7 994
? 8 993
? 9 992
? 10 991
? 11 990
? 12 989
? 13 988
? 14 987
? 15 986
? 16 985
? 17 984
? 18 983
? 19 982
? 20 981
? 21 980
? 22 979
? 23 978
? 24 977
? 25 976
? 26 975
? 27 974
? 28 973
? 29 972
? 30 971
? 31 970
? 32 969
? 33 968
? 34 967
? ...

result:

ok Correct (1 test case)

Test #33:

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

input:

1
1000
1
1

output:

? 1 1000
? 2 999
! 1

result:

ok Correct (1 test case)

Test #34:

score: 0
Accepted
time: 2ms
memory: 3588kb

input:

1
1000
0
0
0
0
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...

output:

? 1 1000
? 2 999
? 3 998
? 4 997
? 5 996
? 6 995
? 7 994
? 8 993
? 9 992
? 10 991
? 11 990
? 12 989
? 13 988
? 14 987
? 15 986
? 16 985
? 17 984
? 18 983
? 19 982
? 20 981
? 21 980
? 22 979
? 23 978
? 24 977
? 25 976
? 26 975
? 27 974
? 28 973
? 29 972
? 30 971
? 31 970
? 32 969
? 33 968
? 34 967
? ...

result:

ok Correct (1 test case)

Test #35:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

2
500
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 500
? 2 499
? 3 498
? 4 497
? 5 496
? 6 495
? 7 494
? 8 493
? 9 492
? 10 491
? 11 490
? 12 489
? 13 488
? 14 487
? 15 486
? 16 485
? 17 484
? 18 483
? 19 482
? 20 481
? 21 480
? 22 479
? 23 478
? 24 477
? 25 476
? 26 475
? 27 474
? 28 473
? 29 472
? 30 471
? 31 470
? 32 469
? 33 468
? 34 467
? 3...

result:

ok Correct (2 test cases)

Test #36:

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

input:

2
500
1
1
500
1
1

output:

? 1 500
? 2 499
! 1
? 1 500
? 2 499
! 1

result:

ok Correct (2 test cases)

Test #37:

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

input:

2
500
1
1
500
0
0
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
...

output:

? 1 500
? 2 499
! 1
? 1 500
? 2 499
? 3 498
? 4 497
? 5 496
? 6 495
? 7 494
? 8 493
? 9 492
? 10 491
? 11 490
? 12 489
? 13 488
? 14 487
? 15 486
? 16 485
? 17 484
? 18 483
? 19 482
? 20 481
? 21 480
? 22 479
? 23 478
? 24 477
? 25 476
? 26 475
? 27 474
? 28 473
? 29 472
? 30 471
? 31 470
? 32 469
?...

result:

ok Correct (2 test cases)

Test #38:

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

input:

4
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 250
? 2 249
? 3 248
? 4 247
? 5 246
? 6 245
? 7 244
? 8 243
? 9 242
? 10 241
? 11 240
? 12 239
? 13 238
? 14 237
? 15 236
? 16 235
? 17 234
? 18 233
? 19 232
? 20 231
? 21 230
? 22 229
? 23 228
? 24 227
? 25 226
? 26 225
? 27 224
? 28 223
? 29 222
? 30 221
? 31 220
? 32 219
? 33 218
? 34 217
? 3...

result:

ok Correct (4 test cases)

Test #39:

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

input:

4
250
1
1
250
1
1
250
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
1
1
250
1
1

output:

? 1 250
? 2 249
! 1
? 1 250
? 2 249
! 1
? 1 250
? 2 249
? 3 248
? 4 247
? 5 246
? 6 245
? 7 244
? 8 243
? 9 242
? 10 241
? 11 240
? 12 239
? 13 238
? 14 237
? 15 236
? 16 235
? 17 234
? 18 233
? 19 232
? 20 231
? 21 230
? 22 229
? 23 228
? 24 227
? 25 226
? 26 225
? 27 224
? 28 223
? 29 222
? 30 221...

result:

ok Correct (4 test cases)

Test #40:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

4
250
0
0
0
0
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
1
1
250
0
0
0
0
1
0
1
250
1
0
0
1
250
1
0
...

output:

? 1 250
? 2 249
? 3 248
? 4 247
? 5 246
? 6 245
? 7 244
? 8 243
? 9 242
? 10 241
? 11 240
? 12 239
? 13 238
? 14 237
? 15 236
? 16 235
? 17 234
? 18 233
? 19 232
? 20 231
? 21 230
? 22 229
? 23 228
? 24 227
? 25 226
? 26 225
? 27 224
? 28 223
? 29 222
? 30 221
? 31 220
? 32 219
? 33 218
? 34 217
? 3...

result:

ok Correct (4 test cases)

Test #41:

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

input:

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

output:

? 1 1000
? 2 999
? 3 998
? 4 997
? 5 996
? 6 995
? 7 994
? 8 993
? 9 992
? 10 991
? 11 990
? 12 989
? 13 988
? 14 987
? 15 986
? 16 985
? 17 984
? 18 983
? 19 982
? 20 981
? 21 980
? 22 979
? 23 978
? 24 977
? 25 976
? 26 975
? 27 974
? 28 973
? 29 972
? 30 971
? 31 970
? 32 969
? 33 968
? 34 967
? ...

result:

ok Correct (1 test case)

Extra Test:

score: 0
Extra Test Passed