답안 #500173

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500173 2021-12-30T12:18:27 Z reni Red-blue table (IZhO19_stones) C++14
27 / 100
23 ms 1452 KB
#include<iostream>
#pragma GCC optimize ("-O3")
#define endl '\n'
using namespace std;
char s[1003][1003];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long n,m,i,j,t,ans,i2, num=0;
    bool isf;

    cin>>t;

    while(t--)
    {
        cin>>n>>m;
        isf=0;
        if(n<m){swap(n,m); isf=1;}

        ans=0;

        for(i=1;i<=n;i++)
        {
            for(j=1;j<=m;j++)
            {
                s[i][j]='-';
            }
        }
        num=0;
        for(i=1;i<=(n/2+1);i++)
        {
            for(j=1;j<=(m/2+1);j++)
            {
                s[i][j]='+';
            }

        }
        ans=n;
        ans+=m-(m/2+1);
        for(;i<=n;i++)
        {
            for(j=m;j>=m-(m/2+1);j--)
            {
                s[i][j]='+';
            }
        }

        cout<<ans<<endl;
        if(!isf)
        {
            for(i=1;i<=n;i++)
            {
             for(j=1;j<=m;j++)
            {
                    cout<<s[i][j];
            }  cout<<endl;
        }
        }
        else
        {
            for(i=1;i<=m;i++)
            {
              for(j=1;j<=n;j++)
             {
                    if(s[j][i]=='+')cout<<'-';
                    else cout<<'+';
            } cout<<endl;
        }

        }

    }

}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:12:29: warning: unused variable 'i2' [-Wunused-variable]
   12 |     long long n,m,i,j,t,ans,i2, num=0;
      |                             ^~
stones.cpp:12:33: warning: variable 'num' set but not used [-Wunused-but-set-variable]
   12 |     long long n,m,i,j,t,ans,i2, num=0;
      |                                 ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 2 ms 332 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 1408 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 1452 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 2 ms 332 KB Wrong answer in test 5 29: 31 < 32