답안 #371155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
371155 2021-02-26T01:55:55 Z daniel920712 Red-blue table (IZhO19_stones) C++14
27 / 100
56 ms 1924 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
int all[1005][1005];
int main()
{
    int T,N,M,ans=0,i,j;
    scanf("%d",&T);
    while(T--)
    {
        ans=0;
        scanf("%d %d",&N,&M);
        if(N<=M)
        {
            ans=M;
            for(i=0;i<=N/2;i++) for(j=0;j<M;j++) all[i][j]=0;
            for(i=N/2+1;i<N;i++)
            {
                ans++;
                for(j=0;j<M;j++) all[i][j]=1;
            }
        }
        else
        {
            ans=N;
            for(i=0;i<=M/2;i++) for(j=0;j<N;j++) all[j][i]=1;
            for(i=M/2+1;i<M;i++)
            {
                ans++;
                for(j=0;j<N;j++) all[j][i]=0;
            }
        }
        printf("%d\n",ans);
        for(i=0;i<N;i++)
        {
            for(j=0;j<M;j++)
            {
                if(all[i][j]==0) printf("-");
                else printf("+");
            }
            printf("\n");
        }
    }
    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%d",&T);
      |     ~~~~~^~~~~~~~~
stones.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |         scanf("%d %d",&N,&M);
      |         ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Incorrect 3 ms 620 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 1924 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 1900 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Incorrect 3 ms 620 KB Wrong answer in test 5 29: 31 < 32