Submission #990405

# Submission time Handle Problem Language Result Execution time Memory
990405 2024-05-30T11:07:45 Z tch1cherin Red-blue table (IZhO19_stones) C++17
15 / 100
17 ms 1448 KB
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int N, M;
    cin >> N >> M;
    int H = N - 2 + N % 2, W = M - 2 + M % 2;
    if (H + W < max(N, M)) {
      if (N > M) {
        cout << N << "\n";
        for (int i = 0; i < N; i++) {
          cout << string(M, '+') << "\n";
        }
      } else {
        cout << N << "\n";
        for (int i = 0; i < N; i++) {
          cout << string(M, '-') << "\n";
        }
      }
    } else if (N == 4 && M == 3) {
      cout << "5\n+-+\n+-+\n+-+\n+-+\n";
    } else if (N == 3 && M == 4) {
      cout << "5\n----\n++++\n----\n";
    } else if (N == 4 && M == 4) {
      cout << "5\n+++-\n+++-\n+++-\n+++-\n";
    } else if (N == 6 && M == 6) {
      cout << "9\n++++--\n+++-+-\n+++--+\n++++--\n+++-+-\n+++--+\n";
    } else {
      cout << H + W << "\n";
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
          if (i < H && j < W) {
            cout << "+-"[(i + j) % 2];
          } else if (i < H) {
            cout << "+";
          } else {
            cout << "-";
          }
        }
        cout << "\n";
      }
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB in the table A+B is not equal to 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB in the table A+B is not equal to 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1448 KB in the table A+B is not equal to 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1360 KB Output is correct
2 Correct 13 ms 1044 KB Output is correct
3 Correct 12 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB in the table A+B is not equal to 1
2 Halted 0 ms 0 KB -