QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412886#6743. water235Guren_AC ✓160ms3688kbC++2020.2kb2024-05-16 21:06:052024-05-16 21:06:06

Judging History

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

  • [2024-05-16 21:06:06]
  • 评测
  • 测评结果:AC
  • 用时:160ms
  • 内存:3688kb
  • [2024-05-16 21:06:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    if (m == 1)
            {
                cout << n / 2 + 1 << endl;
                for (int i = 1; i <= n-1;i++)
                {
                    if(i%2==1)
                    cout << "1" << endl;

                else
                {
                    cout << "0" << endl;
                }
                }
                cout << 1 << endl;
            }
            else if(n==1)
            {

                        {
                            cout << m / 2 + 1 << endl;
                                for (int i = 1; i <= m - 1; i++)
                                {
                                    if (i % 2 == 1)
                                    {
                                        cout << "1 ";
                                    }
                                    else
                                    {
                                        cout << "0 ";
                                    }
                                }
                                cout << "1" << endl;
            }
            }
       else if (n >= m)
        {
            if ((n-m+ 1) % 2 == 1)
            {
                if (m == n)
                {
                    cout << n << endl;
                }
                else if ((m - n) % 2 == 1)
                    cout << n + (m - n) / 2 + 1 << endl;
                else
                {
                    cout << n + (m - n) / 2 << endl;
                }
            int cnt = 1;
            for (int i = 1; i <= m; i++)
            {
                for (int j = 1; j <= m; j++)
                {
                    if (j == cnt)
                    {
                        cout << 1 << " ";
                    }
                    else
                        cout << 0 << " ";
                }
                cnt++;
                cout << endl;
            }
            for (int i = 1; i <= n - m; i++)
            {
                for (int i = 1; i <= m - 1; i++)
                {
                    cout << 0 << " ";
                }
                if(i==n-m)
                {
                    cout << 1 << endl;
                }
                else
                {
                if(i%2==0)
                cout << 1 << endl;
                else 
                cout<<0<<endl;
                }
            }
            }
            else 
            {
                if (m == n)
                {
                    cout << n << endl;
                }
                else if ((m - n) % 2 == 1)
                    cout << n + (m - n) / 2 + 1 << endl;
                else
                {
                    cout << n + (m - n) / 2 << endl;
                }
                int cnt = 1;
                for (int i = 1; i <= m; i++)
                {
                    for (int j = 1; j <= m; j++)
                    {
                        if (j == cnt)
                        {
                            cout << 1 << " ";
                        }
                        else
                            cout << 0 << " ";
                    }
                    cnt++;
                    cout << endl;
                }
                for (int i = 1; i <= n - m; i++)
                {
                    for (int i = 1; i <= m - 1; i++)
                    {
                        cout << 0 << " ";
                    }
                    if(i==n-m)
                    {
                        cout << 1 << endl;
                    }
                    else 
                    {
                    if (i % 2 == 0)
                        cout << 1 << endl;
                    else
                        cout << 0 << endl;
                    }
                }
            }
        }
        else
        {
            if((m-n+1)%2==1)
            {
                if (m == n)
                {
                    cout << n << endl;
                }
                else if ((m - n) % 2 == 1)
                    cout << n + (m - n) / 2 + 1 << endl;
                else
                {
                    cout << n + (m - n) / 2 << endl;
                }
                int cnt = 1;
                for (int i = 1; i <= n; i++)
                {
                    if (i == n)
                    {
                        for (int i = 1; i <= n - 1; i++)
                        {
                            cout << 0 << " ";
                        }
                        int flag = 1;
                        for (int i = 1; i <= m - n + 1; i++)
                        {
                            if (flag == 1)
                                cout << 1 << " ";
                            else
                            {
                                cout << 0 << " ";
                            }
                            if (flag == 1)
                                flag = 0;
                            else
                                flag = 1;
                        }
                    }
                    else
                    {
                        for (int j = 1; j <= m; j++)
                        {
                            if (j == cnt)
                            {
                                cout << 1 << " ";
                            }
                            else
                                cout << 0 << " ";
                        }
                        cout << endl;
                        cnt++;
                    }
            }
            }
            else 
            {
                if (m == n)
                {
                    cout << n << endl;
                }
                else if((m-n)%2==1)
                    cout << n + (m - n) / 2+1<< endl;
                    else 
                    {
                        cout << n + (m - n) / 2<< endl;
                    }
                int cnt = 1;
                for (int i = 1; i <= n; i++)
                {
                    if (i == n)
                    {
                        for (int i = 1; i <= n - 1; i++)
                        {
                            cout << 0 << " ";
                        }
                        int flag = 1;
                        for (int i = 1; i <= m - n; i++)
                        {
                            if (flag == 1)
                                cout << 1 << " ";
                            else
                            {
                                cout << 0 << " ";
                            }
                            if (flag == 1)
                                flag = 0;
                            else
                                flag = 1;
                        }
                        cout << 1;
                    }
                    else
                    {
                        for (int j = 1; j <= m; j++)
                        {
                            if (j == cnt)
                            {
                                cout << 1 << " ";
                            }
                            else
                                cout << 0 << " ";
                        }
                        cout << endl;
                        cnt++;
                    }
                }
            }
        }
    
    //     int n,m;
    //     cin >> n >> m;
    //     if(m==1)
    //     {
    //         cout << n / 2 + 1 << endl;
    //         for (int i = 1; i <= n-1;i++)
    //         {
    //             if(i%2==1)
    //             cout << "1" << endl;

    //         else
    //         {
    //             cout << "0" << endl;
    //         }
    //         }
    //         cout << 1 << endl;
    //     }
    //     else
    // {
    //     if(n%2==1)
    //     {
    //         if(m==2)
    //         {
    //             cout << m + (n - 1) / 2 << endl;
    //             cout<<1<<" "<<1<<endl;
    //             int flag = 1;
    //             for (int i = 2; i <= n; i++)
    //             {

    //                 if (i % 2 == 1)
    //                 {
    //                     if (flag == 1)
    //                     {
    //                         for (int j = 1; j <= m; j++)
    //                         {
    //                             if (j % 2 == 1)
    //                             {
    //                                 cout << "1 ";
    //                             }
    //                             else
    //                             {
    //                                 cout << "0 ";
    //                             }
    //                         }
    //                         cout << endl;
    //                     }
    //                     if (flag == 0)
    //                     {
    //                         for (int j = 1; j <= m; j++)
    //                         {
    //                             if (j % 2 == 0)
    //                             {
    //                                 cout << "1 ";
    //                             }
    //                             else
    //                             {
    //                                 cout << "0 ";
    //                             }
    //                         }
    //                         cout << endl;
    //                     }
    //                     if (flag == 1)
    //                         flag = 0;
    //                     else
    //                         flag = 1;
    //                 }

    //                 else
    //                 {
    //                     for (int j = 1; j <= m; j++)
    //                     {
    //                         cout << "0 ";
    //                     }
    //                     cout << endl;
    //                 }
    //             }

    //         }
    //         else if(n==1)
    //         {
    //             cout << m / 2 + 1 << endl;
    //                 for (int i = 1; i <= m - 1; i++)
    //                 {
    //                     if (i % 2 == 1)
    //                     {
    //                         cout << "1 ";
    //                     }
    //                     else
    //                     {
    //                         cout << "0 ";
    //                     }
    //                 }
    //                 cout << "1" << endl;

    //         }
    //         else
    //         {
    //        // cout<<n/3
    //        long long ans = 0;
    //        int flag1 = 0;
    //        for (int i = 1; i <= n; i += 2)
    //        {
    //            if (m % 2 == 1)
    //            {
    //                if (i % 2 == 1 && flag1 == 0)
    //                {
    //                    ans += m / 2 + 1;
    //                }
    //                else if (i % 2 == 1 && flag1 == 1)
    //                {
    //                    ans += m / 2;
    //                }
    //                if (flag1 == 0)
    //                    flag1 = 1;
    //                else
    //                    flag1 = 0;
    //            }
    //            else
    //            {
    //                if (i % 2 == 1 && flag1 == 0)
    //                {
    //                    ans += m / 2;
    //                }
    //                else if (i % 2 == 1 && flag1 == 1)
    //                {
    //                    ans += m / 2;
    //                }
    //                if (flag1 == 0)
    //                    flag1 = 1;
    //                else
    //                    flag1 = 0;
    //            }
    //        }
    //        cout << ans << endl;

    //        int flag = 1;
    //        for (int i = 1; i <= n; i++)
    //        {

    //            if (i % 2 == 1)
    //            {
    //                if (flag == 1)
    //                {
    //                    for (int j = 1; j <= m; j++)
    //                    {
    //                        if (j % 2 == 1)
    //                        {
    //                            cout << "1 ";
    //                        }
    //                        else
    //                        {
    //                            cout << "0 ";
    //                        }
    //                    }
    //                    cout << endl;
    //                }
    //                if (flag == 0)
    //                {
    //                    for (int j = 1; j <= m; j++)
    //                    {
    //                        if (j % 2 == 0)
    //                        {
    //                            cout << "1 ";
    //                        }
    //                        else
    //                        {
    //                            cout << "0 ";
    //                        }
    //                    }
    //                    cout << endl;
    //                }
    //                if (flag == 1)
    //                    flag = 0;
    //                else
    //                    flag = 1;
    //            }

    //            else
    //            {
    //                for (int j = 1; j <= m; j++)
    //                {
    //                    cout << "0 ";
    //                }
    //                cout << endl;
    //            }

    //         }
    //        }

    //     }
    //     else
    //     {
    //         if(n==2&&m==2)
    //         {
    //             cout << 2 << endl;
    //             cout << "1 0" << endl;
    //             cout << "0 1" << endl;
    //         }
    //         else if(n==2&&m%2==0)
    //         {
    //             long long ans = 0;
    //             int flag1 = 0;
    //             for (int i = 1; i <= n; i += 2)
    //             {
    //                 if (m % 2 == 1)
    //                 {
    //                     if (i % 2 == 1 && flag1 == 0)
    //                     {
    //                         ans += m / 2 + 1;
    //                     }
    //                     else if (i % 2 == 1 && flag1 == 1)
    //                     {
    //                         ans += m / 2;
    //                     }
    //                     if (flag1 == 0)
    //                         flag1 = 1;
    //                     else
    //                         flag1 = 0;
    //                 }
    //                 else
    //                 {
    //                     if (i % 2 == 1 && flag1 == 0)
    //                     {
    //                         ans += m / 2;
    //                     }
    //                     else if (i % 2 == 1 && flag1 == 1)
    //                     {
    //                         ans += m / 2;
    //                     }
    //                     if (flag1 == 0)
    //                         flag1 = 1;
    //                     else
    //                         flag1 = 0;
    //                 }
    //             }
    //             cout << ans + 1 << endl;
    //             int flag = 1;
    //             for (int i = 1; i <= n - 1; i++)
    //             {
    //                 if (i % 2 == 1)
    //                 {
    //                     if (flag == 1)
    //                     {
    //                         for (int j = 1; j <= m; j++)
    //                         {
    //                             if (j % 2 == 1)
    //                             {
    //                                 cout << "1 ";
    //                             }
    //                             else
    //                             {
    //                                 cout << "0 ";
    //                             }
    //                         }
    //                         cout << endl;
    //                     }
    //                     if (flag == 0)
    //                     {
    //                         for (int j = 1; j <= m; j++)
    //                         {
    //                             if (j % 2 == 0)
    //                             {
    //                                 cout << "1 ";
    //                             }
    //                             else
    //                             {
    //                                 cout << "0 ";
    //                             }
    //                         }
    //                         cout << endl;
    //                     }
    //                     if (flag == 1)
    //                         flag = 0;
    //                     else
    //                         flag = 1;
    //                 }

    //                 else
    //                 {
    //                     for (int j = 1; j <= m; j++)
    //                     {
    //                         cout << "0 ";
    //                     }
    //                     cout << endl;
    //                 }
    //             }
    //             for (int i = 1; i <= m - 1; i++)
    //             {
    //                 cout << "0 ";
    //             }
    //             cout << 1;
    //             cout << endl;
    //         }
    //         else
    //         {
    //         long long ans = 0;
    //         int flag1 = 0;
    //         for (int i = 1; i <= n; i+=2)
    //         {
    //             if(m%2==1)
    //             {
    //             if (i % 2 == 1 && flag1 == 0)
    //             {
    //                 ans += m / 2 + 1;

    //             }
    //             else if (i % 2 == 1 && flag1 == 1)
    //             {
    //                 ans += m / 2;

    //             }
    //             if (flag1 == 0)
    //                 flag1 = 1;
    //             else
    //                 flag1 = 0;
    //             }
    //             else
    //             {
    //             if (i % 2 == 1 && flag1 == 0)
    //             {
    //                 ans += m / 2;

    //             }
    //             else if (i % 2 == 1 && flag1 == 1)
    //             {
    //                 ans += m / 2;

    //             }
    //             if (flag1 == 0)
    //                 flag1 = 1;
    //             else
    //                 flag1 = 0;
    //             }
    //         }
    //         cout << ans+1 << endl;
    //         int flag = 1;
    //         for (int i = 1; i <= n-1; i++)
    //         {
    //             if (i % 2 == 1)
    //             {
    //                 if (flag == 1)
    //                 {
    //                     for (int j = 1; j <= m; j++)
    //                     {
    //                         if (j % 2 == 1)
    //                         {
    //                             cout << "1 ";
    //                         }
    //                         else
    //                         {
    //                             cout << "0 ";
    //                         }
    //                     }
    //                     cout << endl;
    //                 }
    //                 if (flag == 0)
    //                 {
    //                     for (int j = 1; j <= m; j++)
    //                     {
    //                         if (j % 2 == 0)
    //                         {
    //                             cout << "1 ";
    //                         }
    //                         else
    //                         {
    //                             cout << "0 ";
    //                         }
    //                     }
    //                     cout << endl;
    //                 }
    //                 if (flag == 1)
    //                     flag = 0;
    //                 else
    //                     flag = 1;
    //             }

    //             else
    //             {
    //                 for (int j = 1; j <= m; j++)
    //                 {
    //                     cout << "0 ";
    //                 }
    //                 cout << endl;
    //             }
    //         }
    //         cout << "1 ";
    //         for (int i = 1; i <= m - 1;i++)
    //         {
    //             cout << "0 ";
    //         }
    //         cout << endl;
    //     }
    // }
    // }

}



详细

Test #1:

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

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

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

input:

1 4

output:

3
1 0 1 1

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

2
1 0 
0 1 

result:

ok The answer is correct.

Test #5:

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

input:

2 4

output:

3
1 0 0 0 
0 1 0 1 

result:

ok The answer is correct.

Test #6:

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

input:

4 3

output:

4
1 0 0 
0 1 0 
0 0 1 
0 0 1

result:

ok The answer is correct.

Test #7:

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

input:

4 4

output:

4
1 0 0 0 
0 1 0 0 
0 0 1 0 
0 0 0 1 

result:

ok The answer is correct.

Test #8:

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

input:

1 789

output:

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

result:

ok The answer is correct.

Test #9:

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

input:

2 444

output:

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

result:

ok The answer is correct.

Test #10:

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

input:

2 445

output:

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

result:

ok The answer is correct.

Test #11:

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

input:

3 333

output:

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

result:

ok The answer is correct.

Test #12:

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

input:

3 332

output:

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

result:

ok The answer is correct.

Test #13:

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

input:

224 4

output:

114
1 0 0 0 
0 1 0 0 
0 0 1 0 
0 0 0 1 
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 1
0 0 ...

result:

ok The answer is correct.

Test #14:

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

input:

31 31

output:

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

result:

ok The answer is correct.

Test #15:

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

input:

31 30

output:

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

result:

ok The answer is correct.

Test #16:

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

input:

128 128

output:

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

result:

ok The answer is correct.

Test #17:

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

input:

1000 1000

output:

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

result:

ok The answer is correct.

Test #18:

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

input:

1 1

output:

1
1

result:

ok The answer is correct.

Test #19:

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

input:

999 999

output:

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

result:

ok The answer is correct.

Test #20:

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

input:

2 499999

output:

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

result:

ok The answer is correct.

Test #21:

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

input:

1 999999

output:

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

result:

ok The answer is correct.

Test #22:

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

input:

10 99998

output:

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

result:

ok The answer is correct.

Test #23:

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

input:

100 10000

output:

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

result:

ok The answer is correct.

Test #24:

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

input:

99 9999

output:

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

result:

ok The answer is correct.

Test #25:

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

input:

9998 99

output:

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

result:

ok The answer is correct.

Test #26:

score: 0
Accepted
time: 44ms
memory: 3560kb

input:

1000 999

output:

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

result:

ok The answer is correct.

Test #27:

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

input:

488889 2

output:

244446
1 0 
0 1 
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0
0 1
0 0...

result:

ok The answer is correct.

Test #28:

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

input:

31112 31

output:

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

result:

ok The answer is correct.

Test #29:

score: 0
Accepted
time: 41ms
memory: 3560kb

input:

3111 310

output:

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

result:

ok The answer is correct.