QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#605872#7863. Parity Gameucup-team4906AC ✓2ms3836kbC++1413.7kb2024-10-02 20:19:552024-10-02 20:19:55

Judging History

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

  • [2024-10-02 20:19:55]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3836kb
  • [2024-10-02 20:19:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;

void solve()
{
    int n, t;
    cin >> n >> t;
    vi a(n + 2);
    for (int i = 1; i <= n; i++)
        cin >> a[i];

    int sz = n;

    auto opt = [&](int p, char op)
    {
        vi res(n + 2);
        sz--;
        for (int i = 1; i < p; i++)
            res[i] = a[i];
        if (op == '+') res[p] = (a[p] + a[p + 1]) % 2;
        else res[p] = a[p] * a[p + 1];
        for (int i = p + 2; i <= n; i++)
            res[i - 1] = a[i];
        a = res;
    };

    auto get0 = [&](int x)
    {
        if (a[x] == 0 || a[x + 1] == 0)
        {
            cout << x << " *";
            cout << endl;
            opt(x, '*');
        }
        else
        {
            cout << x << " +";
            cout << endl;
            opt(x, '+');
        }
    };

    auto get1 = [&](int x)
    {
        if (a[x] & a[x + 1])
        {
            cout << x << " *";
            cout << endl;
            opt(x, '*');
        }
        else
        {
            cout << x << " +";
            cout << endl;
            opt(x, '+');            
        }

    };

    if ((t == 0 && (n & 1 ^ 1)))
    {
        cout << "Alice";
        cout << endl;
        for (int i = 1; i < n / 2; i++)
        {
            opt(1, '+');
            cout << 1 << " +";
            cout << endl;
            int p;
            char op;
            cin >> p >> op;
            opt(p, op);
        }
        if (a[1] == 0 || a[2] == 0)
            cout << 1 << " *";
        else
            cout << 1 << " +";
        cout << endl;
    }
    else if ((t == 1 && (n & 1)))
    {
        cout << "Bob";
        cout << endl;

        for (int i = 1; i <= n / 2; i++)
        {
            int p;
            char op;
            cin >> p >> op;
            opt(p, op);

            if (i == n / 2)
            {
                if (a[1] == 0 || a[2] == 0)
                    cout << 1 << " *";
                else
                    cout << 1 << " +";
                cout << endl;  
            }
            else
            {
                opt(1, '+');
                cout << 1 << " +";
                cout << endl;
            }
        }
    }
    else if (t == 0 && n & 1)
    {
        int p = 0;
        int mark = 0;
        for (int i = 1; i <= n; i++)
        {
            if (a[i] == 0)
            {
                int now = i - 1 - p;
                if ((now & 1 ^ 1) && !(now == 0 && p == 0))
                {
                    mark = 1;
                }
                p = i;

            }
        }
        int now = n - p;
        if (now & 1 ^ 1)
            mark = 1;
        if (a[1] == 0 || a[n] == 0)
            mark = 1;
        if (mark)
        {
            cout << "Alice";
            cout << endl;


            for (int i = 1; i <= n / 2; i++)
            {
                if (a[1] == 0)
                {
                    get0(2);
                }
                else if (a[sz] == 0)
                {
                    get0(sz - 2);
                }
                else
                {

                    int p = 0;
                    int mark = 0;
                    for (int i = 1; i <= sz; i++)
                    {
                        if (a[i] == 0)
                        {
                            int now = i - 1 - p;
                            if ((now & 1 ^ 1) && !(now == 0 && p == 0))
                            {
                                // p + 1, i - 1;
                                if (now == 0)
                                {
                                    // i - 1, i
                                    if (i - 1 >= 3)
                                    {
                                        get0(i - 3);
                                    }
                                    else
                                    {
                                        get0(i + 1);
                                    }
                                }
                                else
                                {
                                    get0(i - 2);
                                }
                                mark = 1;
                                break;
                            }
                            p = i;

                        }
                    }  

                    if (!mark)
                    {
                        int now = sz - p;
                        assert((now & 1 ^ 1) && !(now == 0 && p == 0));
     

                        get0(p + 1);
                    }                       
                }
                int p;
                char op;
                cin >> p >> op;
                opt(p, op);
            }
        }   
        else
        {
            cout << "Bob";
            cout << endl;
            for (int i = 1; i <= n / 2; i++)
            {
                int p;
                char op;
                cin >> p >> op;
                opt(p, op);

                if (a[1] == 0)
                {
                    get1(1);
                }
                else if (a[sz] == 0)
                    get1(sz - 1);
                else
                {
                    int mark = 0;
                    for (int j = 1; j < sz; j++)
                    {
                        if (a[j] == 0 && a[j + 1] == 0)
                        {
                            if (j > 1)
                            {
                                assert(a[j - 1] == 1);
                                get1(j - 1);
                            }
                            else
                            {
                                assert(a[j + 2] == 1);
                                get1(j + 1);
                            }
                            mark = 1;
                            break;
                        }
                    }
                    if (!mark)
                    {
                        int flag = 0;
                        for (int i = 1; i <= sz; i++)
                            if (a[i] == 0)
                            {
                                if (i > 1)
                                    get1(i - 1);
                                else
                                    get1(i);
                                flag = 1;
                                break;
                            }
                        if (!flag)
                            get1(1);
                    }
                }
                    
            }
        }
    }
    else
    {
        if (n == 2)
        {
            if (a[1] == 1 || a[2] == 1)
            {
                cout << "Alice";
                cout << endl;
                if (a[1] == 0 || a[2] == 0)
                {
                    cout << 1 << " +";
                    cout << endl;
                }
                else
                {
                    cout << 1 << " *";
                    cout << endl;
                }
            }
            else
            {
                cout << "Bob\n";
                cout << endl;
                int p;
                char op;
                cin >> p >> op;
            }
            return;
        }
        int ans = 0;
        for (int ch = 0; ch <= 1 && !ans; ch++)
            for (int pos = 1; pos < n && !ans; pos++)
            {
                char op = ((ch == 0) ? '+' : '*');
                vi res(n + 2);
                sz--;
                for (int i = 1; i < pos; i++)
                    res[i] = a[i];
                if (op == '+') res[pos] = (a[pos] + a[pos + 1]) % 2;
                else res[pos] = a[pos] * a[pos + 1];
                for (int i = pos + 2; i <= n; i++)
                    res[i - 1] = a[i];
                

                int p = 0;
                int mark = 0;
                for (int i = 1; i <= sz; i++)
                {
                    if (res[i] == 0)
                    {
                        int now = i - 1 - p;
                        if ((now & 1 ^ 1) && !(now == 0 && p == 0))
                        {
                            mark = 1;
                        }
                        p = i;

                    }
                }
                int now = sz - p;
                if (now & 1 ^ 1)
                    mark = 1;
                if (res[1] == 0 || res[sz] == 0)
                    mark = 1;

                // if (pos == 1 && op == '+')
                // {
                //     for (int i = 1; i <= sz; i++)
                //         cerr << res[i] << " \n"[i == sz];
                //     cerr << mark << "\n";
                // }
                
                if (mark == 0)
                {
                    cout << "Alice";
                    cout << endl;

                    cout << pos << " " << op;
                    cout << endl;
                    a = res;
                    for (int i = 1; i <= n / 2 - 1; i++)
                    {
                        int p;
                        char op;
                        cin >> p >> op;
                        opt(p, op);

                        if (a[1] == 0)
                        {
                            get1(1);
                        }
                        else if (a[sz] == 0)
                            get1(sz - 1);
                        else
                        {
                            int mark = 0;
                            for (int j = 1; j < sz; j++)
                            {
                                if (a[j] == 0 && a[j + 1] == 0)
                                {
                                    if (j > 1)
                                    {
                                        assert(a[j - 1] == 1);
                                        get1(j - 1);
                                    }
                                    else
                                    {
                                        assert(a[j + 2] == 1);
                                        get1(j + 1);
                                    }
                                    mark = 1;
                                    break;
                                }
                            }
                            if (!mark)
                            {
                                int flag = 0;
                                for (int i = 1; i <= sz; i++)
                                    if (a[i] == 0)
                                    {
                                        if (i > 1)
                                            get1(i - 1);
                                        else
                                            get1(i);
                                        flag = 1;
                                        break;
                                    }
                                if (!flag)
                                    get1(1);
                            }
                        }
                            
                    }
                    ans = 1;
                }
                
                sz++;
            }
        
        if (!ans)
        {
            assert(sz == n);

            cout << "Bob";
            cout << endl;
            int p;
            char op;
            cin >> p >> op;
            opt(p, op);
            for (int i = 1; i <= n / 2 - 1; i++)
            {
                if (a[1] == 0)
                {
                    get0(2);
                }
                else if (a[sz] == 0)
                {
                    get0(sz - 2);
                }
                else
                {
                    int p = 0;
                    int mark = 0;
                    for (int i = 1; i <= sz; i++)
                    {
                        if (a[i] == 0)
                        {
                            int now = i - 1 - p;
                            if ((now & 1 ^ 1) && !(now == 0 && p == 0))
                            {
                                // p + 1, i - 1;
                                if (now == 0)
                                {
                                    // i - 1, i
                                    if (i - 1 >= 3)
                                    {
                                        get0(i - 3);
                                    }
                                    else
                                    {
                                        get0(i + 1);
                                    }
                                }
                                else
                                {
                                    get0(i - 2);
                                }
                                mark = 1;
                                break;
                            }
                            p = i;

                        }
                    }  

                    if (!mark)
                    {
                        int now = sz - p;
                        assert((now & 1 ^ 1) && !(now == 0 && p == 0));
     

                        get0(p + 1);
                    }                  
                }
                int p;
                char op;
                cin >> p >> op;
                opt(p, op);
            }            
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for (int i = 1; i <= T; i++)
        solve();

    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 1
0 1 0 1
1 *
1

output:

Alice
1 +
1 +

result:

ok The player wins!

Test #2:

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

input:

4 0
1 0 1 0
1 *
1

output:

Alice
1 +
1 *

result:

ok The player wins!

Test #3:

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

input:

5 1
1 1 1 0 0
4 +
1 +
1

output:

Bob
1 +
1 *

result:

ok The player wins!

Test #4:

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

input:

3 0
1 1 1
1 +
1

output:

Bob
1 +

result:

ok The player wins!

Test #5:

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

input:

3 1
1 0 1
1 *
1

output:

Bob
1 *

result:

ok The player wins!

Test #6:

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

input:

3 0
1 0 1
1 *
1

output:

Bob
1 +

result:

ok The player wins!

Test #7:

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

input:

2 1
0 1
1

output:

Alice
1 +

result:

ok The player wins!

Test #8:

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

input:

499 0
0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 ...

output:

Alice
2 +
2 +
2 +
2 *
2 +
2 *
2 +
2 *
2 *
2 +
2 *
2 +
2 +
2 *
2 +
2 +
2 *
2 +
2 *
2 *
2 +
2 +
2 +
2 +
2 *
2 +
2 +
2 *
2 +
2 +
2 *
2 +
2 +
2 +
2 *
2 +
2 +
2 +
2 +
2 *
2 +
2 +
2 +
2 *
2 +
2 +
2 *
2 +
2 *
2 +
2 *
2 +
2 *
2 +
2 +
2 *
2 *
2 *
2 *
2 +
2 +
2 +
2 +
2 +
2 *
2 *
2 +
2 *
2 +
2 +
2 +
2 *
2 *
2 ...

result:

ok The player wins!

Test #9:

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

input:

499 0
1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 ...

output:

Bob
1 +
1 +
1 +
1 +
3 +
5 +
5 +
7 +
9 +
11 +
11 +
13 +
13 +
17 +
17 +
17 +
17 +
17 +
19 +
21 +
23 +
23 +
23 +
25 +
25 +
29 +
31 +
33 +
33 +
33 +
33 +
35 +
37 +
43 +
45 +
47 +
47 +
49 +
49 +
51 +
51 +
53 +
57 +
59 +
59 +
61 +
63 +
63 +
65 +
65 +
69 +
69 +
71 +
73 +
75 +
75 +
77 +
77 +
83 +
85 +
85 +
...

result:

ok The player wins!

Test #10:

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

input:

500 0
0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 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
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #12:

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

input:

499 1
1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 ...

output:

Bob
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #13:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
3 +
3 +
5 +
11 +
11 +
13 +
13 +
13 +
15 +
15 +
15 +
19 +
21 +
21 +
23 +
23 +
25 +
25 +
25 +
27 +
27 +
27 +
33 +
35 +
35 +
35 +
37 +
37 +
39 +
41 +
41 +
43 +
45 +
45 +
45 +
45 +
49 +
51 +
51 +
57 +
57 +
59 +
61 +
63 +
65 +
71 +
71 +
73 +
73 +
73 +
75 +
77 +
77 +
...

result:

ok The player wins!

Test #14:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #15:

score: 0
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 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #17:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #18:

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

input:

499 1
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 1 0 1 0 1 0 1 0 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+
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #20:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #21:

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

input:

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

result:

ok The player wins!

Test #23:

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

input:

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

output:

Alice
499 +
1 +
1 +
1 +
3 +
3 +
3 +
3 +
5 +
5 +
5 +
11 +
13 +
13 +
13 +
15 +
15 +
15 +
17 +
19 +
21 +
23 +
23 +
25 +
25 +
25 +
27 +
27 +
27 +
27 +
35 +
35 +
35 +
37 +
37 +
39 +
39 +
41 +
43 +
43 +
45 +
47 +
47 +
47 +
49 +
53 +
53 +
59 +
59 +
61 +
61 +
65 +
65 +
71 +
71 +
73 +
73 +
75 +
77 +
79 +
79 ...

result:

ok The player wins!

Test #24:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #25:

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

input:

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

output:

Alice
251 +
3 +
5 +
11 +
27 +
37 +
41 +
45 +
53 +
61 +
65 +
67 +
91 +
107 +
109 +
111 +
113 +
115 +
119 +
125 +
133 +
135 +
139 +
155 +
155 +
179 +
185 +
201 +
221 +
235 +
243 +
247 +
269 +
269 +
275 +
277 +
289 +
317 +
327 +
341 +
343 +
347 +
357 +
359 +
369 +
369 +
373 +
381 +
387 +
391 +
391 +
1 ...

result:

ok The player wins!

Test #26:

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

input:

500 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 1 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 1 0 1 0 1 0 1 0 1 0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1 +
1 +
1 +
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 The player wins!

Test #28:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #29:

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

input:

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

output:

Alice
323 +
5 +
13 +
15 +
17 +
17 +
21 +
21 +
21 +
21 +
23 +
25 +
25 +
31 +
35 +
37 +
39 +
45 +
47 +
49 +
51 +
55 +
59 +
77 +
77 +
79 +
81 +
81 +
83 +
85 +
93 +
93 +
95 +
99 +
105 +
111 +
111 +
111 +
113 +
119 +
125 +
125 +
129 +
135 +
135 +
135 +
139 +
149 +
153 +
159 +
161 +
161 +
165 +
169 +
169 ...

result:

ok The player wins!

Test #30:

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

input:

350 0
1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 ...

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #31:

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

input:

350 1
1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

Alice
181 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
3 +
3 +
5 +
5 +
5 +
5 +
7 +
7 +
9 +
9 +
9 +
9 +
11 +
11 +
11 +
11 +
11 +
13 +
13 +
13 +
15 +
15 +
15 +
15 +
17 +
17 +
19 +
19 +
21 +
21 +
23 +
25 +
25 +
27 +
27 +
29 +
31 +
33 +
33 +
35 +
35 +
35 +
35 +
35 +
35 +
35 +
37 +
37 +
37 +
41 +
43 +
45 +
45 +...

result:

ok The player wins!

Test #32:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #33:

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

input:

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

output:

Bob
497 *
495 *
493 *
491 *
489 *
487 *
485 *
483 *
481 *
479 *
477 *
475 *
473 *
471 *
469 *
467 *
465 *
463 *
461 *
459 *
457 *
455 *
453 *
451 *
449 *
447 *
445 *
443 *
441 *
439 *
437 *
435 *
433 *
431 *
429 *
427 *
425 *
423 *
421 *
419 *
417 *
415 *
413 *
411 *
409 *
407 *
405 *
403 *
401 *
39...

result:

ok The player wins!

Test #34:

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

input:

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

result:

ok The player wins!

Test #38:

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

input:

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

output:

Alice
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #39:

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

input:

500 1
1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 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+
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
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 The player wins!

Test #41:

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

input:

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

output:

Bob
19 +
17 +
15 +
13 +
11 +
9 +
7 +
4 +
2 +
4 *
4 +
4 *
4 *
4 *
4 *
4 +
4 +
4 *
4 +
4 +
4 +
4 +
4 +
4 *
4 +
4 *
4 *
4 +
4 +
4 +
4 +
4 *
4 +
4 +
4 *
4 *
4 +
4 +
4 +
4 *
4 +
4 +
4 +
4 *
4 *
4 +
4 +
4 *
4 +
4 +
4 +
4 *
4 +
4 +
4 *
4 +
4 +
4 +
4 +
4 +
4 *
4 *
4 *
4 +
4 *
4 *
4 *
4 *
4 +
4 *
4 +
4 +
4 +...

result:

ok The player wins!

Test #42:

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

input:

39 0
1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1
3 +
5 +
5 +
7 +
9 +
9 +
9 +
11 +
15 +
17 +
1 *
1 *
1 *
1 *
1 *
1 *
1 *
1 *
1 *
1

output:

Bob
1 +
3 +
3 +
5 +
7 +
7 +
7 +
9 +
13 +
15 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +
1 +

result:

ok The player wins!

Test #43:

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

input:

9 0
1 0 1 1 1 1 1 1 1
3 +
3 +
3 +
1 *
1

output:

Bob
1 +
1 +
1 +
1 +

result:

ok The player wins!

Extra Test:

score: 0
Extra Test Passed