QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#811841#9783. Duloc NetworkI_Love_Sonechka#RE 11ms4196kbC++202.7kb2024-12-13 03:26:372024-12-13 03:26:42

Judging History

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

  • [2024-12-13 03:26:42]
  • 评测
  • 测评结果:RE
  • 用时:11ms
  • 内存:4196kb
  • [2024-12-13 03:26:37]
  • 提交

answer

#include <complex.h>
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi pair<int, int>
#define pb push_back

using namespace std;
using ll = long long;

template<typename T_container, typename T = typename enable_if
    <!is_same<T_container, string>::value, typename
    T_container::value_type>::type>

ostream& operator<<(ostream &os, const T_container &v) {
    os << '{';
    string sep;
    for(const T &x : v) {
        os << sep << x;
        sep = ", ";
    }
    return os << '}';
}


void dbg_out(){cerr<<endl;}
template <typename Head, typename... Tail>void dbg_out(Head H
    , Tail... T){cerr << ' ' << H; dbg_out(T...); }

#define dbg(...) dbg_out(__VA_ARGS__)

// #define TEST_CASES
#define vt vector

const int amax = 12;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void get() {
    int n = 200;
    double res = 0;
    for(int i = 1; i < n; ++i) {
        double P = 1;
        for(int j = 1; j <= i; ++j) {
            P /= i;
            res += P * j;
            P *= (i-1);
        }
    }
    cout << 2 * res << '\n';
}

const int MAX_QUERIES = 3500;

void solve() {
    int n; cin >> n;
    map<string, int> queries;
    auto Ask = [&](string s) -> int {
        if(queries.count(s)) {
            return queries[s];
        }
        assert(queries.size() < MAX_QUERIES);
        cout << "? " << s << endl;
        fflush(stdout);
        int ret; cin >> ret;
        return queries[s] = ret;
    };
    string S;
    for(int i = 0; i < n; ++i) {
        S.push_back('0');
    }
    string T = S;
    S[0] = '1';
    for(int i = 1; i < n; ++i) {
        vt<int> other;
        for(int j = 0; j < n; ++j) if(S[j] == '0') {
            other.push_back(j);
        }
        int value = Ask(S);
        if(value == n - i) {
            break;
        }
        if(value == 0) {
            cout << "! 0" << endl;
            fflush(stdout);
            return ;
        }
        shuffle(other.begin(), other.end(), rng);
        for(auto u: other) {
            T[u] = '1';
            int u_value = Ask(T);
            T[u] = '0';
            S[u] = '1';
            int u_and_s = Ask(S);
            S[u] = '0';
            int s_value = Ask(S);
            int inter = s_value + u_value - u_and_s;
            if(inter != 0) {
                S[u] = '1';
                break;
            }
        }
    }
    cout << "! 1" << endl;
    fflush(stdout);
}

int main() {
    // cin.tie(0)->sync_with_stdio(0);
int tt = 1;
#ifdef TEST_CASES
    cin >> tt;
#endif
    while(tt--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1
2
2

output:

? 1000
? 0001
? 1001
! 1

result:

ok Correct answer with 3 queries.

Test #2:

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

input:

2
0

output:

? 10
! 0

result:

ok Correct answer with 1 queries.

Test #3:

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

input:

4
1
3
2

output:

? 1000
? 0100
? 1100
! 1

result:

ok Correct answer with 3 queries.

Test #4:

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

input:

2
0

output:

? 10
! 0

result:

ok Correct answer with 1 queries.

Test #5:

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

input:

50
3
1
4
2
5
1
4
4
7
1
4
3
5
1
6
2
4
2
6
2
5
3
8
9
3
8
1
6
3
8
2
7
1
6
2
7
2
7
6
4
9
1
6
2
7
1
6
1
6
7
3
8
1
6
1
6
4
6
6
7
4
8
9
10
1
11
3
9
10
12
15
1
13
3
14
15
14
2
13
1
12
2
11
11
12
2
12
13
1
13
4
15
1
15
3
16
19
17
2
16
16
16
3
15
16
16
15
15
3
14
15
2
13
12
13
1
12
15
13
13
12
13
13
11
12
10
...

output:

? 10000000000000000000000000000000000000000000000000
? 00001000000000000000000000000000000000000000000000
? 10001000000000000000000000000000000000000000000000
? 00000000010000000000000000000000000000000000000000
? 10000000010000000000000000000000000000000000000000
? 000000010000000000000000000000000...

result:

ok Correct answer with 146 queries.

Test #6:

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

input:

50
10
11
15
15
23
11
28
10
32
10
35
11
35
9
36
8
36
6
36
8
37
11
36
10
35
9
35
7
35

output:

? 10000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000010000000
? 10000000000000000000000000000000000000000010000000
? 00000000000010000000000000000000000000000000000000
? 10000000000010000000000000000000000000000010000000
? 000000000000000000000000000000000...

result:

ok Correct answer with 29 queries.

Test #7:

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

input:

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

output:

? 10000000000000000000000000000000000000000000000000
? 00000000000000000000000000000010000000000000000000
? 10000000000000000000000000000010000000000000000000
? 00000000100000000000000000000000000000000000000000
? 10000000100000000000000000000000000000000000000000
? 000000000000000000000010000000000...

result:

ok Correct answer with 155 queries.

Test #8:

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

input:

50
2
6
8
7
9
10
12
8
10
10
11
4
15
10
19
8
25
7
26
9
30
31
8
33
6
33
7
33
9
33
11
36
35
8
35
8
35

output:

? 10000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000100000
? 10000000000000000000000000000000000000000000100000
? 00000000000000000000000000000000000000000000000100
? 10000000000000000000000000000000000000000000000100
? 000000000001000000000000000000000...

result:

ok Correct answer with 37 queries.

Test #9:

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

input:

50
3
1
4
1
4
1
2
1
3
2
4
1
1
1
2
5
6
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
2
3
3
4
2
1
2
1
2
2
3
2
3
2
3
1
2
3
1
2
2
3
2
1
3
4
1
2
3
2
6
2
2
1
2
1
2
2
2
1
0

output:

? 10000000000000000000000000000000000000000000000000
? 01000000000000000000000000000000000000000000000000
? 11000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000010000000000000000
? 10000000000000000000000000000000010000000000000000
? 000000000000000000100000000000000...

result:

ok Correct answer with 73 queries.

Test #10:

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

input:

100
1
1
2
1
2
3
4
3
4
1
2
1
2
2
3
1
2
3
4
5
6
1
2
3
4
2
3
3
4
2
3
1
2
3
4
2
3
2
3
1
2
1
2
1
2
2
3
3
4
1
2
4
5
1
2
1
2
1
2
1
2
1
2
2
3
1
2
1
2
1
2
3
4
1
2
2
3
2
3
1
2
2
3
1
2
4
5
3
4
1
2
2
3
1
2
2
3
1
2
1
2
2
3
1
2
2
3
1
2
2
3
1
2
1
2
1
2
1
2
1
2
4
5
3
4
2
3
2
3
3
4
5
6
1
2
2
3
3
4
1
2
1
2
3
4
2
3
2
...

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000
? 10000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000...

result:

ok Correct answer with 171 queries.

Test #11:

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

input:

100
11
13
23
8
28
8
33
7
40
6
35
12
41
11
45
10
48
10
51
7
56
8
61
10
63
9
65
10
67
6
68
9
69
11
71
10
72
6
71
11
72
16
71
9
73
8
73
5
72
10
71
16
71
8
70
5
69
8
68
9
67
10
66
12
67
11
66
7
65
6
64
5
63
9
62
11
61
10
60
5
59
16
59

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000
? 10000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 83 queries.

Test #12:

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

input:

100
5
3
8
2
7
1
6
2
7
1
6
3
6
5
11
2
8
3
9
8
2
8
2
8
5
11
1
7
4
10
2
8
5
11
4
8
2
10
13
1
9
2
10
9
6
12
13
3
15
8
18
4
21
3
24
3
23
1
23
5
27
30
3
26
29
3
28
2
29
7
32
2
33
7
39
4
39
6
40
3
41
3
42
2
41
6
42
44
3
43
5
43
5
43
42
6
43
3
44
43
4
43
4
44
45
2
43
42
3
41
43
3
42
5
43
4
44
1
43
2
43
4
42...

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000
? 10000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000...

result:

ok Correct answer with 213 queries.

Test #13:

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

input:

100
1
2
3
3
4
2
3
1
2
1
2
1
2
2
3
2
3
1
2
3
4
1
2
2
3
3
4
5
5
7
1
6
4
9
6
3
8
6
8
4
10
2
8
1
7
1
7
2
8
1
7
1
7
3
8
4
12
10
4
12
1
9
2
8
1
9
11
4
12
1
9
1
9
9
1
9
1
9
3
9
10
1
10
1
8
1
9
1
9
2
10
2
10
1
9
11
4
12
12
3
9
4
9
10
1
8
2
10
9
1
7
1
8
1
8
1
8
1
8
8
1
8
8
3
10
2
9
1
6
8
1
7
3
9
7
2
8
1
7
10...

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000
? 10000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 457 queries.

Test #14:

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

input:

100
1
1
2
1
2
1
2
3
4
1
2
3
4
1
2
5
6
1
2
1
2
4
5
3
4
1
2
1
2
2
3
2
3
1
2
1
2
1
2
1
2
3
4
3
4
1
2
1
2
2
3
1
2
2
3
2
3
1
2
1
2
1
2
2
3
1
2
1
2
1
2
1
2
3
4
2
3
1
2
1
0

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000
? 10000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 81 queries.

Test #15:

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

input:

150
4
3
7
4
8
3
7
4
8
3
7
4
8
2
6
3
7
2
6
1
5
1
5
4
7
4
11
2
9
3
10
3
9
3
12
1
10
3
10
11
5
15
4
14
3
13
2
12
2
12
3
13
5
11
4
13
4
16
3
19
6
17
20
4
19
4
22
1
23
4
24
28
4
26
4
28
2
30
5
31
32
34
2
34
32
4
36
36
4
33
6
37
3
39
4
42
42
3
44
44
2
45
3
46
6
49
3
52
4
51
3
50
2
51
2
50
1
49
2
51
1
48
2...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 293 queries.

Test #16:

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

input:

150
4
2
6
3
7
2
6
3
7
4
8
6
10
2
6
3
7
2
6
3
7
2
6
2
6
5
8
3
11
12
1
9
1
7
2
9
9
1
8
2
9
3
10
1
8
2
9
9
5
10
1
11
5
14
1
15
2
16
2
16
4
18
3
17
2
16
5
17
2
16
1
17
4
17
4
18
8
25
2
27
3
26
27
28
1
27
1
26
3
27
2
27
29
28
1
26
2
27
4
27
1
28
1
28
29
4
30
2
32
4
31
32
33
34
3
35
3
36
38
2
38
3
38
4
42...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000...

result:

ok Correct answer with 345 queries.

Test #17:

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

input:

150
3
1
4
3
6
5
6
3
9
3
9
2
8
1
7
1
7
2
8
1
7
4
9
7
15
1
16
3
17
2
19
3
20
2
19
2
18
19
1
19
2
19
2
20
4
24
3
21
4
22
5
26
5
29
5
32
2
34
3
34
1
34
7
37
2
39
1
38
2
37
3
39
1
38
39
1
40
2
41
2
40
1
41
1
40
41
3
43
42
3
43
41
1
41
41
2
42
4
42
2
44
5
43
2
44
4
46
47
1
48
2
49
1
48
2
48
1
48
2
49
3
49...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000...

result:

ok Correct answer with 372 queries.

Test #18:

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

input:

150
4
3
7
3
7
1
5
1
5
2
6
2
6
2
6
2
6
2
6
2
6
2
6
5
9
1
5
1
5
1
5
4
8
2
6
4
6
2
8
4
10
3
8
10
3
11
2
10
2
10
3
11
5
13
9
3
11
12
9
2
10
3
11
3
11
1
9
1
9
2
10
1
9
1
9
3
10
1
11
14
3
13
2
11
13
1
12
15
1
12
2
13
14
3
14
13
3
14
3
14
2
12
3
14
1
15
15
4
18
3
16
20
3
16
3
18
19
2
18
1
19
3
20
2
21
2
23...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000...

result:

ok Correct answer with 404 queries.

Test #19:

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

input:

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

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 718 queries.

Test #20:

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

input:

200
1
1
2
3
4
1
2
2
3
2
3
1
2
1
2
2
3
1
2
1
2
1
2
2
3
1
2
3
4
1
2
1
2
4
5
1
2
2
3
1
2
1
2
2
3
1
2
1
2
1
2
1
2
1
2
2
3
2
3
1
2
1
2
1
2
2
3
1
2
1
2
1
2
1
2
2
3
1
2
1
2
2
3
1
2
1
2
1
2
1
2
2
3
1
2
1
2
4
5
1
2
1
2
2
3
1
2
1
2
2
3
2
3
1
2
1
2
1
2
2
3
1
2
1
2
3
4
3
4
1
2
1
2
1
2
1
2
3
4
1
2
1
2
1
2
5
6
4
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1139 queries.

Test #21:

score: 0
Accepted
time: 8ms
memory: 4124kb

input:

200
3
2
5
1
4
1
4
1
4
2
5
1
4
2
5
2
5
2
5
1
4
3
6
1
4
2
5
2
5
4
7
3
6
3
6
2
5
3
4
8
1
5
1
5
2
6
1
5
2
6
1
5
2
6
2
6
2
6
2
6
1
5
3
7
1
5
6
2
6
1
5
1
5
1
5
5
1
5
6
2
6
1
5
2
6
2
6
3
7
2
6
1
5
1
5
1
5
2
6
4
8
1
5
7
2
6
1
5
2
6
1
5
1
5
2
4
2
6
5
5
2
6
5
2
6
6
5
1
5
7
6
2
6
4
8
5
1
5
1
5
6
5
9
2
6
5
3
7
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1580 queries.

Test #22:

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

input:

200
1
2
3
1
2
1
2
1
2
3
4
3
4
1
2
2
3
1
2
1
2
3
4
1
2
1
2
2
3
1
2
1
2
2
3
2
3
3
4
2
3
2
3
3
4
2
3
1
2
2
3
2
3
1
2
5
6
1
2
1
2
2
3
2
3
2
3
1
2
1
2
5
6
3
4
2
3
1
2
3
4
1
2
1
2
1
2
3
4
2
3
1
2
4
5
2
3
1
2
2
3
3
4
1
2
2
3
2
3
1
2
2
3
1
2
2
3
2
3
3
4
1
2
3
4
1
2
3
4
3
4
1
2
3
4
1
2
2
3
1
2
1
2
2
3
3
4
3
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000...

result:

ok Correct answer with 365 queries.

Test #23:

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

input:

200
1
1
2
2
3
1
2
4
5
2
3
1
2
1
2
3
4
3
4
1
2
3
4
3
4
2
3
1
2
2
3
1
2
2
3
1
2
2
3
3
4
4
5
2
3
1
2
1
2
2
3
3
4
3
4
3
4
2
3
3
4
1
2
1
2
2
3
1
2
1
2
1
2
2
3
1
2
2
3
4
5
1
2
2
3
1
2
2
3
1
2
2
3
2
3
2
3
3
4
1
2
3
4
2
3
1
2
1
2
3
4
2
3
1
2
2
3
2
3
1
2
2
3
2
3
3
4
2
3
3
4
2
3
3
4
1
2
1
2
3
4
3
4
1
2
2
3
3
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1283 queries.

Test #24:

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

input:

200
1
1
2
3
4
5
6
4
4
3
7
1
5
4
8
3
7
2
6
3
7
1
5
3
7
3
7
3
7
4
8
3
7
3
7
3
7
3
7
2
6
3
7
2
6
1
5
2
6
1
5
3
7
4
8
5
9
2
6
4
8
2
6
1
5
5
9
2
6
3
7
4
8
2
6
2
6
2
6
3
7
2
6
4
8
3
7
3
6
2
8
4
10
3
9
2
8
1
7
8
3
9
3
9
3
7
9
5
10
2
12
12
3
13
13
4
17
2
15
16
3
14
3
16
3
17
3
20
2
19
4
21
2
19
2
19
20
21
7...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 486 queries.

Test #25:

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

input:

200
6
2
8
9
15
1
6
8
14
2
8
3
9
5
11
7
13
9
14
10
22
2
22
3
25
7
27
6
33
2
27
4
31
1
28
2
27
5
29
4
33
8
36
1
37
7
42
43
4
45
2
46
3
49
7
53
2
47
3
49
1
50
5
51
3
53
3
53
3
54
59
3
60
5
64
2
64
3
65
2
67
5
67
2
69
3
68
6
72
4
74
5
73
4
75
3
74
1
74
4
74
1
74
5
74
77
3
78
2
77
6
77
7
77
1
78
4
80
81
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 374 queries.

Test #26:

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

input:

200
2
3
4
4
6
6
11
6
17
4
14
3
17
1
15
4
18
3
16
5
20
7
26
7
32
6
37
4
39
6
43
3
45
7
50
4
53
4
55
4
59
3
57
4
58
2
57
3
59
2
59
1
59
4
61
5
63
4
63
2
64
3
65
3
65
3
66
2
66
6
68
3
70
1
70
3
71
4
71
4
72
5
75
4
75
5
77
7
77
80
3
78
79
2
78
4
78
5
79
5
80
4
79
9
80
4
82
4
82
3
83
4
85
6
85
4
87
2
86
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 415 queries.

Test #27:

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

input:

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

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 487 queries.

Test #28:

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

input:

200
6
6
12
6
12
4
10
6
12
2
8
9
14
8
22
6
20
5
19
3
17
5
19
5
19
4
17
2
19
3
19
2
21
21
24
1
20
4
23
5
24
10
28
3
31
5
33
30
2
30
5
30
4
32
4
35
3
36
2
37
8
40
3
42
6
46
3
48
2
48
6
52
3
54
8
56
2
58
4
55
3
57
4
58
5
60
8
64
67
4
70
3
70
73
5
72
5
74
4
75
5
77
4
78
2
78
10
82
3
82
5
84
6
88
4
90
6
9...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 436 queries.

Test #29:

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

input:

200
7
3
10
3
10
2
9
3
10
5
12
5
12
5
12
4
11
5
12
3
10
4
11
5
12
4
11
10
17
4
11
4
11
6
13
4
11
7
14
3
9
13
4
13
8
17
13
4
13
4
12
3
15
3
15
6
18
5
16
4
20
5
21
7
21
2
23
6
27
3
23
4
27
8
30
2
32
2
32
5
33
38
5
38
6
37
5
42
6
40
4
43
7
49
6
53
8
58
7
59
6
64
5
66
68
2
66
4
67
3
68
3
70
72
4
71
6
73
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000...

result:

ok Correct answer with 363 queries.

Test #30:

score: 0
Accepted
time: 9ms
memory: 3900kb

input:

200
2
3
5
1
3
2
4
1
3
2
4
1
3
2
4
4
6
2
4
1
3
2
4
3
3
1
4
3
6
3
6
3
6
3
6
1
4
1
4
1
4
3
6
1
4
1
4
1
4
1
4
1
4
3
6
2
5
2
5
2
5
2
5
2
5
1
4
1
4
2
5
2
5
2
5
4
7
1
4
1
4
2
5
1
4
1
4
5
1
4
5
8
2
5
2
5
1
4
2
5
2
4
1
5
1
5
3
7
3
7
4
8
2
6
1
5
2
6
8
2
6
8
2
6
1
5
1
5
1
5
1
5
3
7
1
5
1
5
3
7
1
5
1
5
6
2
6
2
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1165 queries.

Test #31:

score: 0
Accepted
time: 11ms
memory: 4064kb

input:

200
1
1
2
1
2
2
3
1
2
1
2
3
4
1
2
3
4
1
2
1
2
2
3
2
3
2
3
1
2
2
3
2
3
2
3
1
2
1
2
1
2
3
4
1
2
1
2
1
2
1
2
2
3
2
3
1
2
1
2
3
4
2
3
1
2
1
2
2
3
1
2
3
4
2
3
1
2
1
2
2
3
1
2
4
5
3
4
3
4
1
2
1
2
2
3
2
3
2
3
1
2
3
4
1
2
2
3
1
2
2
3
3
4
2
3
1
2
2
3
2
3
1
2
3
4
4
5
2
3
3
4
2
3
1
2
1
2
3
4
2
3
3
4
2
3
1
2
2
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1518 queries.

Test #32:

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

input:

200
1
3
4
2
3
2
3
1
2
3
4
1
2
1
2
3
4
1
2
2
3
3
2
2
4
3
5
3
5
1
3
3
5
1
3
1
1
1
2
3
4
1
2
3
4
1
2
1
2
2
3
2
3
2
3
1
2
1
2
3
4
2
3
4
5
4
5
2
3
1
2
3
4
4
5
3
1
2
2
3
4
5
1
2
2
3
2
3
2
3
2
3
2
3
2
3
4
5
1
2
2
3
2
3
4
5
1
2
1
2
1
2
1
2
1
2
2
3
3
4
1
2
2
3
2
3
1
2
2
3
2
3
2
3
2
4
5
3
4
2
3
1
1
3
4
3
2
3
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1140 queries.

Test #33:

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

input:

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

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 996 queries.

Test #34:

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

input:

200
2
3
5
2
4
4
6
1
3
2
4
4
6
2
4
2
4
2
4
2
4
1
3
2
4
1
3
3
5
2
4
1
3
1
3
3
5
1
3
2
4
1
3
3
5
1
3
4
4
2
6
1
5
1
3
3
6
2
5
3
6
1
4
1
4
2
5
2
5
2
5
1
4
2
5
5
4
1
4
3
6
1
4
1
4
1
4
1
4
2
3
2
5
1
4
3
6
4
5
2
3
1
4
3
6
5
2
5
1
4
5
5
2
5
4
7
2
3
2
5
3
6
2
5
2
5
2
5
6
1
4
3
6
5
3
6
6
6
2
5
4
7
5
1
4
3
6
5
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1012 queries.

Test #35:

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

input:

200
3
1
4
3
6
2
5
2
5
2
5
2
5
2
5
3
6
2
5
2
5
2
5
1
4
2
5
2
5
2
5
2
5
2
5
2
5
3
6
2
5
2
5
2
5
2
5
2
5
3
6
2
5
3
6
1
4
2
5
1
4
2
5
2
5
1
4
2
5
2
5
3
6
2
5
2
5
2
5
2
5
3
6
2
5
3
6
3
6
2
5
3
6
2
5
2
5
2
5
3
6
2
5
2
5
2
5
2
5
1
4
3
6
2
5
3
6
2
5
3
6
3
6
3
6
3
6
3
6
2
5
1
4
3
6
3
6
2
5
2
5
3
6
2
5
3
6
1
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 997 queries.

Test #36:

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

input:

200
1
3
4
3
4
2
3
2
3
2
3
3
4
3
4
2
3
2
3
2
3
2
3
3
4
3
4
2
3
3
4
3
4
2
3
3
4
2
3
3
4
3
4
2
3
3
4
3
4
3
4
2
3
3
4
3
4
2
3
3
4
2
3
2
3
3
4
3
4
2
3
2
3
2
3
2
3
3
4
3
4
3
4
3
4
3
4
2
3
2
3
3
4
3
4
3
4
2
3
3
4
3
4
3
4
3
4
2
3
3
4
2
3
2
1
2
3
3
4
3
4
2
3
3
3
4
4
3
4
2
3
1
2
2
3
4
2
3
2
3
3
4
3
4
3
4
4
3
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000...

result:

ok Correct answer with 900 queries.

Test #37:

score: -100
Runtime Error

input:

200
2
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
4
2
3
2
5
2
5
2
5
2
5
5
2
5
2
5
2
5
5
2
5
2
5
2
5
2
5
5
2
5
2
5
2
5
2
5
2
5
2
5
2
5
2
5
2
5
2
5
2
5
2
5
5
5
2
5
2
5
2
5
2
5
2
5
5
2
5
2
5
2
5
5
2
5
2
5
2
5
2
3
2
5
2
5
2
5
5
5
2
5
2
5
1
4
2
5
2
5
2
5
2
5
2
5
2
5
2
5
5
2
5
2
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result: