This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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();
}
# | 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... |