#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxN=1001;
char table[maxN][maxN];
void fillTable(ll n,ll m){
ll mod=n/2+1,rep=m-(m/2+1);
if(m>2){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(j<rep*((i/mod)+1) and j>=rep*(i/mod)){
table[i][j]='-';
}else{
table[i][j]='+';
}
}
}
}else{
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
table[i][j]='+';
}
}
}
}
ll n[maxN],m[maxN];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
ll t,ans1=0,ans2=0;
cin>>t;
for(int i=0;i<t;i++){
cin>>n[i]>>m[i];
}
for(int i=0;i<t;i++){
ll lef1=0,lef2;
lef1=m[i]-(m[i]/2+1);
lef2=n[i]-(n[i]/2+1);
ans1=n[i]+lef1;
ans2=m[i]+lef2;
//cout<<lef1<<" "<<lef2<<"\n";
// cout<<ans1<<" "<<ans2<<"\n";
if(ans1>=ans2){
fillTable(n[i],m[i]);
cout<<ans1<<"\n";
for(int j=0;j<n[i];j++){
for(int h=0;h<m[i];h++){
cout<<table[j][h];
}
cout<<"\n";
}
}else{
fillTable(m[i],n[i]);
cout<<ans2<<"\n";
for(int j=n[i]-1;j>=0;j--){
for(int h=0;h<m[i];h++){
if(table[h][j]=='-'){
cout<<"+";
}else{
cout<<"-";
}
}
cout<<"\n";
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Incorrect |
3 ms |
504 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
1528 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
1528 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Incorrect |
3 ms |
504 KB |
Wrong answer in test 5 29: 31 < 32 |