Submission #882124

# Submission time Handle Problem Language Result Execution time Memory
882124 2023-12-02T16:12:33 Z presko Red-blue table (IZhO19_stones) C++14
27 / 100
2 ms 1372 KB
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,m;
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>t;
    for(int q=0;q<t;q++)
    {
        cin>>n>>m;
        int res1=n>>1,res2=m>>1;
        if(!(n&1))res1--;
        if(!(m&1))res2--;
        if(n+res2>=m+res1)//build more rows
        {
            cout<<n+res2<<"\n";
            string row="";
            for(int i=0;i<m-res2;i++)row+="+";
            for(int i=m-res2;i<m;i++)row+="-";
            for(int i=0;i<n;i++)cout<<row<<"\n";
        }
        else //build more columns
        {
            cout<<m+res1<<"\n";
            string row1="",row2="";
            for(int i=0;i<m;i++){row1+="-";row2+="+";}
            for(int i=0;i<n-res1;i++)cout<<row1<<"\n";
            for(int i=n-res1;i<n;i++)cout<<row2<<"\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1372 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1372 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -