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>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;
#define gcd __gcd
void solve() {
ll a,b;
cin >> a >> b;
if (a>=b){
if (b==2){
cout << a << "\n";
for (int i = 0; i < a; i++){
for (int i = 0; i < b; i++){
cout << '+';
}
cout << "\n";
}
}else{
cout << a+(b/2);
cout << "\n";
for (int i = 0; i < a; i++){
for (int i = 0; i < b-(b/2); i++){
cout << '+';
}
for (int i = 0; i < (b/2); i++){
cout << '-';
}
cout << "\n";
}
}
}else if (a<b){
if (a==2){
cout << b << "\n";
for (int i = 0; i < a; i++){
for (int i = 0; i < b; i++){
cout << '-';
}
cout << "\n";
}
}else{
cout << b+(a/2);
cout << "\n";
for (int i = 0; i < a-(a/2); i++){
for (int i = 0; i < b; i++){
cout << '-';
}
cout << "\n";
}
for (int i = 0; i < (a/2); i++){
for (int i = 0; i < b; i++)cout << '+';
cout << "\n";
}
}
}
}
int main() {
cin.tie(0)->sync_with_stdio(false);
#ifdef null
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int q = 1;
cin >> q;
while (q--) {
solve();
}
}
# | 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... |