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;
void solve() {
int n, m;
cin >> n >> m;
char a[n + 1][m + 1];
if(n == 1) {
for(int i = 1; i <= m; i++)cout << '-';
cout << '\n';
return;
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
if(j % 2 == 1) {
a[i][j] = '+';
}
else a[i][j] = '-';
if(m % 2 == 0 and j == m)a[i][j] = '+';
}
}
int ans = n + m / 2;
if(m % 2 == 0)ans--;
cout << ans << '\n';
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
cout << a[i][j];
}
cout << '\n';
}
}
int main() {
int t;
cin >> t;
while(t--) {
solve();
}
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... |