#include <bits/stdc++.h>
using namespace std;
//------------------------------------------------------------------------------
//******************************************************************************
#define IOS ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0)
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define ll long long
#define MOD 1e9+7
#define endl '\n'
const int mxn=2e5+5;
//******************************************************************************
//------------------------------------------------------------------------------
ll t=1,n,m,ans;
void solve(){
ans=0;
cin>>n>>m;
if(n<m){
ans+=m;
ans+=((n-1)/2);
cout<<ans<<endl;
for(int i=1;i<=n-(((n-1)/2));i++){
for(int i=1;i<=m;i++){
cout<<'-';
}
cout<<endl;
}
for(int i=n-(((n-1)/2))+1;i<=n;i++){
for(int i=1;i<=m;i++){
cout<<'+';
}
cout<<endl;
}
}
else{
ans+=n;
ans+=((m-1)/2);
cout<<ans<<endl;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(j>(m-((m-1)/2))){
cout<<'-';
}
else{
cout<<'+';
}
}
cout<<endl;
}
}
}
int main(){
//IOS;
cin>>t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
3 ms |
364 KB |
Output is correct |
4 |
Incorrect |
4 ms |
492 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
1388 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
1388 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
3 ms |
364 KB |
Output is correct |
4 |
Incorrect |
4 ms |
492 KB |
Wrong answer in test 5 29: 31 < 32 |