#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 ans;
if(n>=m){
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 |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
8 ms |
332 KB |
Output is correct |
4 |
Incorrect |
14 ms |
332 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
75 ms |
1348 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
64 ms |
1412 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
8 ms |
332 KB |
Output is correct |
4 |
Incorrect |
14 ms |
332 KB |
Wrong answer in test 5 29: 31 < 32 |