T=int(input())
for h in range (T):
v,g=[],[]
N,M=list(map(int,input().split()))
if N>1 and M!=1:
A=N
elif M==1:
A=int(N/2-1)
elif N==1:
A=0
if M%2==0 and M!=0 :
B=int(M/2-1)
elif M>1 and A!=0 and M!=0:
B=int(M/2)
elif M==1 :
B=1
if A==0:
B=M
print(A+B)
for i in range (N):
for j in range (M):
g.append('+')
v.append(g)
g=[]
if M%2==0 and N%2==0 and N!=1 and M!=1:
for uu in range(0,int(N/2)+1):
for rr in range(int(M/2)-1):
v[uu][rr]='-'
elif M%2==1 and N%2==1 and N!=1 and M!=1:
for hh in range(0,int(M/2)):
for ll in range(int((len(v))/2)+1):
v[ll][hh]='-'
elif M%2==0 and N%2==1 and N!=1 and M!=1:
for ol in range(int(N/2)+1):
for op in range (int(M/2)-1):
v[ol][op]='-'
elif M%2==1 and N%2==0 and N!=1 and M!=1:
for mol in range(int(N/2)+1):
for omp in range(int(M/2)):
v[mol][omp]='-'
elif N==1:
for oiu in range(M):
v[0][oiu]='-'
elif M==1:
for oiuy in range(int(N/2)-1):
v[oiuy][0]='-'
for j1 in range(len(v)):
for i1 in range(len(v[0])):
print(v[j1][i1],end='')
print()
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
3020 KB |
Output is correct |
2 |
Incorrect |
13 ms |
2928 KB |
in the table A+B is not equal to 1 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
3020 KB |
Wrong answer in test 3 45: 25 < 46 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
3020 KB |
Output is correct |
2 |
Incorrect |
13 ms |
2928 KB |
in the table A+B is not equal to 1 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
660 ms |
4436 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
642 ms |
4428 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
3020 KB |
Output is correct |
2 |
Incorrect |
13 ms |
2928 KB |
in the table A+B is not equal to 1 |