#include "bits/stdc++.h"
using namespace std;
// #define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;
void solve() {
int x, y;
cin >> x >> y;
int A = (x - 1) / 2 + y;
int B = (y - 1) / 2 + x;
int grid[x][y];
if (A > B) {
// pick all y columns
memset(grid, 0, sizeof grid);
int L = (x-1) / 2;
for (int i=0; i<L; i++) {
for (int j=0; j<y; j++) {
grid[i][j] = 1;
}
}
}
else {
// pick all x rows
memset(grid, 1, sizeof grid);
int L = (y - 1) / 2;
for (int i=0; i<x; i++) {
for (int j=0; j<L; j++) {
grid[i][j] = 0;
}
}
}
cout << max(A, B) << endl;
for (int i=0; i<x; i++) {
for (int j=0; j<y; j++) {
cout << (grid[i][j] ? '+' : '-');
}
cout << endl;
}
}
signed main() {
int t;
cin >> t;
while (t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
13 ms |
384 KB |
Output is correct |
4 |
Incorrect |
20 ms |
384 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
82 ms |
1328 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
62 ms |
1348 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
13 ms |
384 KB |
Output is correct |
4 |
Incorrect |
20 ms |
384 KB |
Wrong answer in test 5 29: 31 < 32 |