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 int int64_t
const int mod = 1e9 + 7;
const int inf = 2e18;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int ttt;
cin >> ttt;
while (ttt--) {
int n, m;
cin >> n >> m;
bool inv = false;
if (n > m) {
inv = true;
swap(n, m);
}
vector<string> a(n, string(m, '-'));
int plus_in_col = (n - 1) / 2;
int pos_rows = (plus_in_col * m) / (m / 2 + 1);
int i = 0;
for (int j = 0; j < m; j++) {
for (int q = 0; q < plus_in_col; q++) {
a[i][j] = '+';
i = (i + 1) % pos_rows;
}
}
cout << pos_rows + m << '\n';
if (inv) {
swap(n, m);
vector<string> b(n, string(m, '-'));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
b[i][j] = a[j][i] == '-' ? '+' : '-';
}
}
a = b;
}
for (int i = 0; i < n; i++) {
cout << a[i] << '\n';
}
}
}
# | 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... |