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>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mp make_pair
#define mt make_tuple
#define ull unsigned long long
#define ll long long
#define dl long double
#define forn(i, n) for(int i = 0; i < n; i++)
using namespace std;
void start() {
int n, m;
cin >> n >> m;
char ans[n][m];
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
if (n > m) {
if (j < m / 2 + 1) {
ans[i][j] = '+';
}
else {
ans[i][j] = '-';
}
}
else {
if (i < n / 2 + 1) {
ans[i][j] = '-';
}
else {
ans[i][j] = '+';
}
}
}
}
if (n > m) {
cout << m - (m / 2 + 1) + n << "\n";
}
else {
cout << n - (n / 2 + 1) + m << "\n";
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
cout << ans[i][j];
}
cout << "\n";
}
}
int main() {
//SPEED;
int t = 1;
cin >> t;
while(t--) {
start();
}
}
# | 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... |