Submission #918545

# Submission time Handle Problem Language Result Execution time Memory
918545 2024-01-30T06:29:08 Z AnarTz Red-blue table (IZhO19_stones) C++14
0 / 100
3 ms 1624 KB
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
    int n,m,i,j,ans=0,c,b;
    cin >> n >> m;
    bool row=true;
    string table[n][m];
    if (n<m)
    {
        for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            table[i][j] = '-';
           
        }
        
    }
    }else{
        for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            table[i][j] = '+';
           
        }
        
    }
    }
    
    if (m>n)
    {
        c=n-(n/2+1);
        b=m+c;
        row=true;
    }else{
        c=m-(m/2+1);
        b=n+c;
        row=false;
    }
    
    if(row==true){
for (i = 0; i < c; i++)
{
    for (j = 0; j < m; j++)
    {
        table[i][j]='+';
    }
    
}




    }
    else{
       for (i = 0; i < c; i++)
{
    for (j = 0; j < m; j++)
    {
        table[j][i]='-';
    }
    
} 
    }
    
    
cout << b<<endl;
for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            cout << table[i][j];
           
        }
        cout << endl;
    }


    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:7:17: warning: unused variable 'ans' [-Wunused-variable]
    7 |     int n,m,i,j,ans=0,c,b;
      |                 ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1624 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB in the table A+B is not equal to 154
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong answer
2 Halted 0 ms 0 KB -