Submission #333664

# Submission time Handle Problem Language Result Execution time Memory
333664 2020-12-07T12:32:05 Z vipghn2003 Red-blue table (IZhO19_stones) C++14
15 / 100
35 ms 4084 KB
#include<bits/stdc++.h>

using namespace std;

int a[1005][1005];

void solve()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++) a[i][j]=0;
    }
    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 2
# 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 2
# Verdict Execution time Memory Grader output
1 Incorrect 35 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 Correct 35 ms 1900 KB Output is correct
2 Correct 30 ms 4084 KB Output is correct
3 Correct 27 ms 3308 KB Output is correct
# 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 2