#include <iostream>
#include <vector>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int N, M;
cin >> N >> M;
vector<vector<char>> table(N, vector<char>(M));
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if ((i + j) % 2 == 0) {
table[i][j] = '+';
} else {
table[i][j] = '-';
}
}
}
int A = 0, B = 0;
for (int i = 0; i < N; i++) {
int redCount = 0, blueCount = 0;
for (int j = 0; j < M; j++) {
if (table[i][j] == '+') redCount++;
else blueCount++;
}
if (redCount > blueCount) A++;
}
for (int j = 0; j < M; j++) {
int redCount = 0, blueCount = 0;
for (int i = 0; i < N; i++) {
if (table[i][j] == '+') redCount++;
else blueCount++;
}
if (blueCount > redCount) B++;
}
cout << A + B << endl;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
cout << table[i][j];
}
cout << endl;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |