Submission #344063

# Submission time Handle Problem Language Result Execution time Memory
344063 2021-01-05T05:27:57 Z Nurlykhan Red-blue table (IZhO19_stones) C++17
0 / 100
45 ms 1644 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1024;

int t;
int n, m;
char a[N][N];

void solve() {
    // n and m odd
    bool tmp = 0;
    if (m > n) {
        tmp = 1;
        swap(n, m);
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (j % 2) a[i][j] = 0;
            else a[i][j] = 1;
        }
    }

    if (tmp) {
        printf("%d\n", n + m / 2);
        for (int j = 0; j < m; j++) {
            for (int i = 0; i < n; i++) {
                if(a[i][j]) printf("-");
                else printf("+");
            }
            printf("\n");
        }
    } else {
        printf("%d\n", n + m / 2);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if(!a[i][j]) printf("-");
                else printf("+");
            }
            printf("\n");
        }
    }
}

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

    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:48:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   48 |     scanf("%d", &t);
      |     ~~~~~^~~~~~~~~~
stones.cpp:50:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   50 |         scanf("%d%d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB in the table A+B is not equal to 21
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1644 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 1516 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 5