Submission #344047

#TimeUsernameProblemLanguageResultExecution timeMemory
344047NurlykhanRed-blue table (IZhO19_stones)C++17
0 / 100
45 ms1388 KiB
#include <bits/stdc++.h>

using namespace std;

int t;
int n, m;

void solve() {
    // n and m odd
    printf("%d\n", n + m / 2);
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < m; j++) {
            if (i % 2 == 0 && j % 2 == 0)
                printf("+");
            if (i % 2 == 0 && j % 2)
                printf("-");
            if (i % 2 && j % 2 == 0)
                printf("-");
            if (i % 2 && j % 2)
                printf("+");
        }
        printf("\n");
    }
    for (int j = 0; j < m; j++) {
        if (j % 2 == 0)
            printf("-");
        if (j % 2)
            printf("+");
    }
    printf("\n");
}

int main() {
    scanf("%d", &t);
    while (t--) {
        scanf("%d%d", &n, &m);
        solve();
    }

    return 0;
}

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |     scanf("%d", &t);
      |     ~~~~~^~~~~~~~~~
stones.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |         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...