#include<bits/stdc++.h>
using namespace std;
const int mx=1005;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
ll n,m,k;
vector<pair<int,int>>v;
bool vis[mx];
ll ans=0;
char arr[mx][mx];
int main(){
int t;cin>>t;
while(t--){
cin>>n>>m;
int x=(m/2);x++;
int z1=n+(m-x);
int xx=n/2;xx++;
int z2=m+(n-xx);
int ans;
if(z1>z2){
int z=(m/2);z++;
ans=n+(m-z);
for(int i=0;i<n;i++){
for(int j=0;j<z;j++){
arr[i][j]='+';
}
for(int j=z;j<m;j++){
arr[i][j]='-';
}
}
} else{
int z=(n/2);z++;
ans=m+(n-z);
for(int i=0;i<m;i++){
for(int j=0;j<z;j++){
arr[j][i]='-';
}
for(int j=z;j<m;j++){
arr[j][i]='+';
}
}
}cout<<ans<<"\n";
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout<<arr[i][j];
}cout<<endl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
8 ms |
368 KB |
Output is correct |
4 |
Incorrect |
15 ms |
360 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
72 ms |
1296 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
59 ms |
1368 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
8 ms |
368 KB |
Output is correct |
4 |
Incorrect |
15 ms |
360 KB |
Wrong answer in test 5 29: 31 < 32 |