#include <bits/stdc++.h>
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int conv(int i) {
if (i%2 == 0) {
return (i-2);
}
else {
return i-1;
}
}
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int T;
cin >> T;
while (T-->0) {
int N, M;
cin >> N >> M;
char board[N][M];
if (max(N, M) >= conv(N)+conv(M)) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
board[i][j] = (N >= M ? '+' : '-');
}
}
}
else {
for (int i = conv(N); i < N; i++) {
for (int j = 0; j < M; j++) {
board[i][j] = '-';
}
}
for (int j = conv(M); j < M; j++) {
for (int i = 0; i < N; i++) {
board[i][j] = '+';
}
}
for (int i = 0; i < conv(N); i++) {
for (int j = 0; j < conv(M); j++) {
board[i][j] = ((i + j)%2 ? '+' : '-');
}
}
}
cout << max(max(N, M), conv(N) + conv(M)) << '\n';
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
cout << board[i][j];
}
cout << '\n';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 4: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 3: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 4: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
1388 KB |
Output is correct |
2 |
Correct |
30 ms |
1900 KB |
Output is correct |
3 |
Correct |
29 ms |
1900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
1388 KB |
Wrong answer in test 4 4: 4 < 5 |
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 |
Wrong answer in test 4 4: 4 < 5 |