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;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
if (n + (m % 2 ? m / 2 : m / 2 - 1) >= m + (n % 2 ? n / 2 : n / 2 - 1)) {
cout << n + (m % 2 ? m / 2 : m / 2 - 1) << "\n";
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
if (j <= m / 2 + 1) {
cout << "+";
} else {
cout << "-";
}
}
cout << "\n";
}
} else {
cout << m + (n % 2 ? n / 2 : n / 2 - 1) << "\n";
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
if (i <= n / 2 + 1) {
cout << "-";
} else {
cout << "+";
}
}
cout << "\n";
}
}
}
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... |