QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#647390#8239. Mysterious TreeCalculatelove#AC ✓6ms3852kbC++141.6kb2024-10-17 13:49:572024-10-17 13:49:58

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 13:49:58]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3852kb
  • [2024-10-17 13:49:57]
  • 提交

answer

#include <bits/stdc++.h>

const int N = 1010;

int n;

bool used[N];

void work() {
    scanf("%d", &n);

    int p = 0, x;
    for (int i = 1; i < n; i += 2) {
        std::cout << "? " << i << " " << i + 1 << std::endl;
        std::cin >> x;
        if (x) {
            p = i;
            break;
        }
    }

    if (n & 1) {
        std::cout << "? " << n - 1 << " " << n << std::endl;
        std::cin >> x;
        if (x)
            p = n - 1;
    }

    if (!p) {
        std::cout << "! 1" << std::endl;
        return;
    }

    used[p] = 1, used[p + 1] = 1;

    int a, b;

    a = 1;
    while (used[a]) a ++;

    used[a] = 1;

    b = 1;
    while (used[b]) b ++;

    used[b] = 1;

    std::cout << "? " << p << " " << a << std::endl;
    std::cin >> x;
    if (!x) {
        int flag1, flag2;

        std::cout << "? " << p + 1 << " " << a << std::endl;
        std::cin >> flag1;

        std::cout << "? " << p + 1 << " " << b << std::endl;
        std::cin >> flag2;

        if (flag1 && flag2) {
            std::cout << "! 2" << std::endl;
        } else {
            std::cout << "! 1" << std::endl;
        }
    } else {
        std::cout << "? " << p << " " << b << std::endl;
        std::cin >> x;

        if (x) {
            std::cout << "! 2" << std::endl;
        } else {
            std::cout << "! 1" << std::endl;
        }
    }

    used[p] = used[p + 1] = used[a] = used[b] = 0;
}

int main() {
    int T;
    scanf("%d", &T);

    while (T --)
        work();
    
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
4
1
0
1
0
4
0
1
1
1

output:

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

result:

ok Correct (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok Correct (87 test cases)

Test #3:

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

input:

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

output:

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

result:

ok Correct (135 test cases)

Test #4:

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

input:

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

output:

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

result:

ok Correct (136 test cases)

Test #5:

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

input:

5
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
0
758
0
0
0
0
0
0
0
0
0
1
0
1
1
70
0
0
0
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
65
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
5
0
0
1
0
1
1

output:

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

result:

ok Correct (5 test cases)

Test #6:

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

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
0
0
0
0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
27
0
0
0
0
0
0...

output:

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

result:

ok Correct (7 test cases)

Test #7:

score: 0
Accepted
time: 6ms
memory: 3636kb

input:

160
4
0
0
9
0
0
0
0
0
7
0
0
0
1
0
1
1
4
0
0
9
0
0
0
0
1
0
1
1
9
0
0
0
0
1
0
1
1
6
0
0
1
0
1
1
7
0
0
0
1
0
1
1
4
0
0
6
0
0
1
0
1
1
4
0
0
5
0
0
1
0
1
1
7
0
0
0
1
0
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
0
1
1
9
0
0
0
0
0
6
0
0
0
9
0
0
0
0
0
5
0
0
1
0
1
1
6
...

output:

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

result:

ok Correct (160 test cases)

Test #8:

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

input:

117
6
0
0
0
7
0
0
0
0
11
0
0
0
0
0
1
0
1
1
4
0
0
11
0
0
0
0
0
0
5
0
0
1
0
1
1
10
0
0
0
0
0
9
0
0
0
0
1
0
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
0
1
1
11
0
0
0
0
0
0
11
0
0
0
0
0
0
8
0
0
0
0
6
...

output:

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

result:

ok Correct (117 test cases)

Test #9:

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

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
0
1
1
15
0
0
0
0
0
0
0
1
0
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
0
1
1
9
0
0
0
0
1
0
1
1
8
0
0
0
0
7
0
0
0
0
7
0
0
0
1
0
1
1
4
0
0
8
0
0
0
1
0
1
1
1...

output:

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

result:

ok Correct (99 test cases)

Test #10:

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

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
0
1
1
13
0
0
0
0
0
0
0
11
0
0
0
0
0
1
0
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
0
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
0
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
0
1
1
12
0
0...

output:

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

result:

ok Correct (84 test cases)

Test #11:

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

input:

23
27
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
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...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 26 27
? 26 1
? 27 1
? 27 2
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? ...

result:

ok Correct (23 test cases)

Test #12:

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

input:

20
39
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
44
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
85
0
0
0
0
0
0
0
0
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
35
0
0
0
0
0
0
0
0
0
1
0
0
1
1
94
0
0
0
0
0
0
0
0
0
1
0
0
0
92
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 38 39
? 37 1
? 37 2
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 25 1
? 26 1
? 26 2
! 2
? 1 2
? 3 4...

result:

ok Correct (20 test cases)

Test #13:

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

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

output:

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

result:

ok Correct (9 test cases)

Test #14:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (6 test cases)

Test #15:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (4 test cases)

Test #16:

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

input:

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

output:

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

result:

ok Correct (146 test cases)

Test #17:

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

input:

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

output:

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

result:

ok Correct (117 test cases)

Test #18:

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

input:

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

output:

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

result:

ok Correct (105 test cases)

Test #19:

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

input:

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

output:

? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 16 17
? 16 1
? 16 2
! 1
? 1 2
? 6 7
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 12 13
? 1 3
? 1 4
! 2
? 1 2
? 4 5
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 18 19
? 18 1
? 18 2
...

result:

ok Correct (86 test cases)

Test #20:

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

input:

20
53
1
1
1
0
61
1
0
1
1
96
1
1
1
60
1
1
1
25
1
1
1
0
18
1
1
1
24
1
1
1
73
1
1
1
0
76
1
1
0
62
1
1
0
33
1
1
1
0
89
1
1
1
0
55
1
1
1
0
71
1
1
1
0
45
1
0
1
1
44
1
1
1
52
1
1
1
46
1
1
0
7
1
1
1
0
7
1
1
1
0

output:

? 1 2
? 52 53
? 52 1
? 52 2
! 1
? 1 2
? 60 61
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 24 25
? 24 1
? 24 2
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 72 73
? 72 1
? 72 2
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 32 33
? 32 1
? 32 2
! 1
? 1 2
? 88...

result:

ok Correct (20 test cases)

Test #21:

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

input:

9
273
1
1
1
0
54
1
1
0
234
1
1
1
256
1
1
1
70
1
1
1
23
1
1
1
0
5
1
1
1
0
81
1
1
1
0
4
1
1
1

output:

? 1 2
? 272 273
? 272 1
? 272 2
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 22 23
? 22 1
? 22 2
! 1
? 1 2
? 4 5
? 4 1
? 4 2
! 1
? 1 2
? 80 81
? 80 1
? 80 2
! 1
? 1 2
? 1 3
? 1 4
! 2

result:

ok Correct (9 test cases)

Test #22:

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

input:

12
92
1
1
1
50
1
1
1
395
1
1
1
0
152
1
1
1
31
1
1
1
0
183
1
0
1
1
13
1
0
1
1
32
1
1
1
21
1
1
1
0
12
1
1
0
14
1
1
0
4
1
1
1

output:

? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 394 395
? 394 1
? 394 2
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 30 31
? 30 1
? 30 2
! 1
? 1 2
? 182 183
? 1 3
? 1 4
! 2
? 1 2
? 12 13
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 20 21
? 20 1
? 20 2
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
...

result:

ok Correct (12 test cases)

Test #23:

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

input:

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

output:

? 1 2
? 956 957
? 956 1
? 956 2
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 6 7
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 10 11
? 10 1
? 10 2
! 1

result:

ok Correct (5 test cases)

Test #24:

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

input:

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

output:

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

result:

ok Correct (81 test cases)

Test #25:

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

input:

24
43
1
0
1
1
87
1
1
1
0
19
0
1
1
1
0
23
0
0
0
1
0
0
0
1
13
1
0
0
1
0
75
1
0
1
0
13
0
0
0
1
0
0
1
1
85
1
0
0
1
1
31
1
0
1
1
24
1
1
1
68
0
1
1
0
94
1
1
1
11
0
0
0
0
0
0
33
1
0
1
1
80
0
0
0
0
0
0
1
0
1
1
85
1
1
1
0
74
1
0
0
0
42
1
0
0
1
65
0
0
0
0
0
0
0
1
0
0
1
1
13
0
0
0
0
0
0
0
5
1
1
1
0
7
0
0
1
0
1...

output:

? 1 2
? 42 43
? 1 3
? 1 4
! 2
? 1 2
? 86 87
? 86 1
? 86 2
! 1
? 1 2
? 3 4
? 18 19
? 18 1
? 18 2
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 22 23
? 7 1
? 8 1
? 8 2
! 1
? 1 2
? 12 13
? 1 3
? 2 3
? 2 4
! 1
? 1 2
? 74 75
? 1 3
? 1 4
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 12 13
? 7 1
? 8 1
? 8 2
! 2
? 1 2
? 84 85
? 1 3
? 2 3
...

result:

ok Correct (24 test cases)

Test #26:

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

input:

9
35
0
0
0
0
1
0
0
1
0
122
0
1
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
1
0
0
0
0
288
1
1
1
173
0
1
0
1
0
45
1
0
1
1
99
1
0
0
1
1
64
0
0
0
0
0
0
0
0
0
1
0
1
1
5
0
0
0

output:

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

result:

ok Correct (9 test cases)

Test #27:

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

input:

8
481
0
0
0
0
1
0
0
1
1
165
0
0
0
0
1
0
1
1
11
0
0
1
0
0
0
0
145
1
1
0
0
0
34
0
0
1
0
1
0
148
1
1
1
12
1
0
1
0
4
0
1
1
1

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 480 481
? 9 1
? 10 1
? 10 2
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 164 165
? 9 1
? 9 2
! 2
? 1 2
? 3 4
? 5 6
? 10 11
? 5 1
? 6 1
? 6 2
! 1
? 1 2
? 144 145
? 144 1
? 145 1
? 145 2
! 1
? 1 2
? 3 4
? 5 6
? 5 1
? 6 1
? 6 2
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 2 3
? 2 4
...

result:

ok Correct (8 test cases)

Test #28:

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

input:

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

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 25 1
? 26 1
? 26 2
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 114 115
? 1 3
? 1 4
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 3 4
? 36 37
? 3 1
? 3 2
! 2
? 1 2
? 3 4
? 5 6
? 5 1
? 6 1
? 6 2
! 1
? 1 2
? 18 19
? 1 3
? 1 4
! ...

result:

ok Correct (10 test cases)

Test #29:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (1 test case)

Test #30:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (2 test cases)

Test #31:

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

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

output:

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

result:

ok Correct (4 test cases)

Test #32:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (1 test case)

Test #33:

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

input:

1
1000
1
1
1

output:

? 1 2
? 1 3
? 1 4
! 2

result:

ok Correct (1 test case)

Test #34:

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

input:

1
1000
0
0
0
0
1
0
1
1

output:

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

result:

ok Correct (1 test case)

Test #35:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (2 test cases)

Test #36:

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

input:

2
500
1
1
1
500
1
1
0

output:

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

result:

ok Correct (2 test cases)

Test #37:

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

input:

2
500
1
1
1
500
0
1
0
1
1

output:

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

result:

ok Correct (2 test cases)

Test #38:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (4 test cases)

Test #39:

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

input:

4
250
1
1
0
250
1
1
0
250
1
1
1
250
1
1
0

output:

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

result:

ok Correct (4 test cases)

Test #40:

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

input:

4
250
0
0
0
0
1
0
1
1
250
0
0
0
0
1
0
1
1
250
0
0
1
1
0
250
0
0
1
0
1
1

output:

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

result:

ok Correct (4 test cases)

Test #41:

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

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 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (1 test case)

Extra Test:

score: 0
Extra Test Passed