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;
int main () {
int t;
cin >> t;
while(t--) {
char red = '+', blue = '-';
int n, m;
bool swapped = false;
cin >> n >> m;
if(n < m) {
swap(n, m);
swap(red, blue);
swapped = true;
}
char table[n][m];
for(int i = 0;i<n;i++) {
for(int j = 0;j<m;j++)table[i][j] = red;
}
int cnt = 0, ans = n;
for(int asdf = 0;asdf<(m-1)/2;asdf++) {
for(int i = 0;i<n;i++) {
table[i][ans-n]=blue;
cnt++;
if(cnt == (n/2) + 1) {
ans++;
cnt = 0;
}
}
}
cout<<ans<<endl;
if(!swapped) {
for(int i = 0;i<n;i++) {
for(int j = 0;j<m;j++) {
cout<<table[i][j];
}
cout<<endl;
}
}
else {
for(int i = 0;i<m;i++) {
for(int j = 0;j<n;j++) {
cout<<table[j][i];
}
cout<<endl;
}
}
}
}
# | 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... |