#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=1005;
void solve(){
int n, m;
cin >> n >> m;
int gran;
if(n>m){
gran=(m-1)/2;
if(n&1){
cout << n+gran*2-1 << '\n';
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(j<gran){
if(i<(n+1)/2){
cout << '-';
}
else{
cout << '+';
}
}
else if(j==gran){
cout << '+';
}
else{
if(i<n/2){
cout << '+';
}
else{
cout << '-';
}
}
}
cout << '\n';
}
}
else{
cout << n+gran << '\n';
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(j<gran){
cout << '-';
}
else{
cout << '+';
}
}
cout << '\n';
}
}
}
else{
gran=(n-1)/2;
if(m&1){
cout << m+gran*2-1 << '\n';
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(i<gran){
if(j<(m+1)/2){
cout << '+';
}
else{
cout << '-';
}
}
else if(i==gran){
cout << '-';
}
else{
if(j<m/2){
cout << '-';
}
else{
cout << '+';
}
}
}
cout << '\n';
}
}
else{
cout << m+gran << '\n';
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(i<gran){
cout << '+';
}
else{
cout << '-';
}
}
cout << '\n';
}
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
in the table A+B is not equal to 4 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
1388 KB |
in the table A+B is not equal to 76 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
1388 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 2 |
2 |
Halted |
0 ms |
0 KB |
- |