Submission #333663

# Submission time Handle Problem Language Result Execution time Memory
333663 2020-12-07T12:29:37 Z vipghn2003 Red-blue table (IZhO19_stones) C++14
0 / 100
36 ms 1900 KB
#include<bits/stdc++.h>

using namespace std;

int a[1005][1005];

void solve()
{
    int n,m;
    cin>>n>>m;
    bool swaps=false;
    if(n<m)
    {
        swap(n,m);
        swaps=true;
    }
    int res=0;
    int t=n/2;
    for(int i=1;i<=(m-1)/2;i++)
    {
        for(int j=1;j<=n;j++,t--)
        {
            a[j][res+1]=1;
            if(!t)
            {
                res++;
                t=n/2+1;
            }
        }
    }
    cout<<res+n<<'\n';
    if(swaps) swap(n,m);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int cur=a[i][j];
            if(swaps) cur=(a[j][i]^1);
            if(cur) cout<<'-';
            else cout<<'+';
        }
        cout<<'\n';
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin>>t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 3
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 620 KB in the table A+B is not equal to 8
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 3
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 1772 KB in the table A+B is not equal to 78
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 1900 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 3