#include<bits/stdc++.h>
using namespace std;
#define int long long
vector < vector < char > > arr(1005 , vector < char > (1005));
void solve(){
bool bl = 0;
int n, m;
cin>>n>>m;
if(n > m){
swap(n, m);
bl = 1;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
arr[i][j] = (bl ? '+' : '-');
}
}
cout<<max(n, m) + min(min(n, m), (min(n, m) / 2 - !(min(n, m) & 1)) * max(n, m) / (max(n, m) / 2 + 1))<<"\n";
for(int i = 1, last = 1; i <= min(min(n, m), (min(n, m) / 2 - !(min(n, m) & 1)) * max(n, m) / (max(n, m) / 2 + 1)); i++){
for(int j = 1; j <= m / 2 + 1; j++, last++){
if(last == m + 1)last = 1;
arr[i][last] = (bl ? '-' : '+');
}
}
if(bl == 0){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++)
cout<<arr[i][j];
cout<<"\n";
}
}
else{
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++)
cout<<arr[j][i];
cout<<"\n";
}
}
cout<<"\n";
}
signed main(){
int tt = 1;
cin>>tt;
while(tt--)solve();
}#include<bits/stdc++.h>
using namespace std;
#define int long long
vector < vector < char > > arr(1005 , vector < char > (1005));
void solve(){
bool bl = 0;
int n, m;
cin>>n>>m;
if(n > m){
swap(n, m);
bl = 1;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
arr[i][j] = (bl ? '+' : '-');
}
}
cout<<max(n, m) + min(min(n, m), (min(n, m) / 2 - !(min(n, m) & 1)) * max(n, m) / (max(n, m) / 2 + 1))<<"\n";
for(int i = 1, last = 1; i <= min(min(n, m), (min(n, m) / 2 - !(min(n, m) & 1)) * max(n, m) / (max(n, m) / 2 + 1)); i++){
for(int j = 1; j <= m / 2 + 1; j++, last++){
if(last == m + 1)last = 1;
arr[i][last] = (bl ? '-' : '+');
}
}
if(bl == 0){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++)
cout<<arr[i][j];
cout<<"\n";
}
}
else{
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++)
cout<<arr[j][i];
cout<<"\n";
}
}
cout<<"\n";
}
signed main(){
int tt = 1;
cin>>tt;
while(tt--)solve();
}
Compilation message
stones.cpp:52:2: error: stray '#' in program
52 | }#include<bits/stdc++.h>
| ^
stones.cpp:52:3: error: 'include' does not name a type
52 | }#include<bits/stdc++.h>
| ^~~~~~~
stones.cpp:56:28: error: redefinition of 'std::vector<std::vector<char> > arr'
56 | vector < vector < char > > arr(1005 , vector < char > (1005));
| ^~~
stones.cpp:5:28: note: 'std::vector<std::vector<char> > arr' previously declared here
5 | vector < vector < char > > arr(1005 , vector < char > (1005));
| ^~~
stones.cpp:58:6: error: redefinition of 'void solve()'
58 | void solve(){
| ^~~~~
stones.cpp:7:6: note: 'void solve()' previously defined here
7 | void solve(){
| ^~~~~
stones.cpp:99:8: error: redefinition of 'int main()'
99 | signed main(){
| ^~~~
stones.cpp:48:8: note: 'int main()' previously defined here
48 | signed main(){
| ^~~~