답안 #404339

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
404339 2021-05-14T08:28:42 Z Ruxandra985 Red-blue table (IZhO19_stones) C++14
27 / 100
9 ms 1356 KB
#include <bits/stdc++.h>

using namespace std;
char a[1010][1010];
int main()
{
    FILE *fin = stdin;
    FILE *fout = stdout;
    int t , n , m , i , j , opt;
    fscanf (fin,"%d",&t);
    for (;t;t--){

        fscanf (fin,"%d%d",&n,&m);

        if (n >= m){

            for (i = 1 ; i <= n ; i++){
                for (j = 1 ; j <= m ; j++){
                    a[i][j] = '+';
                }
            }

            opt = m - (m / 2 + 1);

            for (i = 1 ; i <= n ; i++){
                for (j = 1 ; j <= opt ; j++){
                    a[i][j] = '-';
                }
            }

            fprintf (fout,"%d\n" , n + opt);
            for (i = 1 ; i <= n ; i++){
                for (j = 1 ; j <= m ; j++){
                    fputc(a[i][j] , fout);
                }
                fprintf (fout,"\n");
            }

        }
        else {

            for (i = 1 ; i <= n ; i++){
                for (j = 1 ; j <= m ; j++){
                    a[i][j] = '-';
                }
            }

            opt = n - (n / 2 + 1);

            for (i = 1 ; i <= opt ; i++){
                for (j = 1 ; j <= m ; j++){
                    a[i][j] = '+';
                }
            }

            fprintf (fout,"%d\n" , m + opt);
            for (i = 1 ; i <= n ; i++){
                for (j = 1 ; j <= m ; j++){
                    fputc(a[i][j] , fout);
                }
                fprintf (fout,"\n");
            }

        }



    }
    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:10:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     fscanf (fin,"%d",&t);
      |     ~~~~~~~^~~~~~~~~~~~~
stones.cpp:13:16: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         fscanf (fin,"%d%d",&n,&m);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 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 9 ms 1308 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1356 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 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