#include <iostream>
using namespace std;
int t, n, m, mop;
int main()
{
cin >> t;
for (int tc = 1; tc <= t; tc++)
{
cin >> n >> m;
if (n > m)
{
cout << n + (m/2)-1+(m%2) << '\n';
mop = (m/2)-1+(m%2);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
if (mop-j >= 0)
{
cout << '-';
}
else cout << '+';
}
cout << '\n';
}
}
else
{
cout << m + (n/2)-1+(n%2) << '\n';
mop = (n/2)-1+(n%2);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
if (mop-i >= 0)
{
cout << '+';
}
else cout << '-';
}
cout << '\n';
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
2 ms |
344 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
1208 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1220 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
2 ms |
344 KB |
Wrong answer in test 5 29: 31 < 32 |