#include <iostream>
using namespace std;
void test(int n, int m)
{
int sum = 0;
if(n >= m)
{
sum = n + m / 2 + m % 2 - 1;
}
else
{
sum = m + n / 2 + n % 2 - 1;
}
cout<<sum<<endl;
for(int row = 0;row < n;row++)
{
for(int col = 0;col < m;col++)
{
if(n >= m)
{
if(col < m / 2 + m % 2 - 1)
{
cout<<"-";
}
else
{
cout<<"+";
}
}
else
{
if(row < n / 2 + n % 2 - 1)
{
cout<<"+";
}
else
{
cout<<"-";
}
}
}
cout<<endl;
}
}
int main()
{
int t;
cin>>t;
for(int i = 0;i < t;i++)
{
int n,m;
cin>>n>>m;
test(n,m);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
8 ms |
296 KB |
Output is correct |
4 |
Incorrect |
12 ms |
316 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
1172 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
1244 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 |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
8 ms |
296 KB |
Output is correct |
4 |
Incorrect |
12 ms |
316 KB |
Wrong answer in test 5 29: 31 < 32 |