Submission #494202

# Submission time Handle Problem Language Result Execution time Memory
494202 2021-12-14T18:48:06 Z Amer Red-blue table (IZhO19_stones) C++14
27 / 100
42 ms 1268 KB
#include <iostream>

using namespace std;

void fastscan(int &x)
    {
        bool neg=false;
        register int c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    }

void test(int n, int m)
{
    int sum = 0;

    if(n >= m)
    {
        sum = n + m / 2 + m % 2 - 1;
    }
    else
    {
        sum = m + n / 2 + n % 2 - 1;
    }

    cout<<sum<<endl;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;

    fastscan(t);

    for(int i = 0;i < t;i++)
    {
        int n,m;

        fastscan(n);
        fastscan(m);

        //cin>>n>>m;
        test(n,m);
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Incorrect 10 ms 332 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1268 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 1220 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Incorrect 10 ms 332 KB Wrong answer in test 5 29: 31 < 32