Submission #284745

#TimeUsernameProblemLanguageResultExecution timeMemory
284745dantoh000Red-blue table (IZhO19_stones)C++14
27 / 100
45 ms1400 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int tc;
    scanf("%d",&tc);
    while (tc--){
        int n,m;
        scanf("%d%d",&n,&m);
        if (n > m){
            printf("%d\n",n+(m-1)/2);
            for (int i = 0; i < n; i++){
                for (int j = 0; j < m; j++){
                    if (j < (m-1)/2){
                        printf("-");
                    }
                    else printf("+");
                }
                printf("\n");
            }
        }
        else{
            printf("%d\n",(n-1)/2+m);
            for (int i = 0; i < n; i++){
                for (int j = 0; j < m; j++){
                    if (i < (n-1)/2){
                        printf("+");
                    }
                    else printf("-");
                }
                printf("\n");
            }
        }

    }

}

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%d",&tc);
      |     ~~~~~^~~~~~~~~~
stones.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |         scanf("%d%d",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...