#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "INTERNET"
#define pll pair<ll, ll>
#define pi pair<ll, pll>
#define fi first
#define se second
using namespace std;
const ll mod = 1e17;
const ll N = 3e3+5;
const int base = 350;
const int base2 = 311;
ll n, m, t, k, T, tong, a[N][N], b[N], c[N], d[N], ans, dp[N], lab[N], h[N], P[N][20];
vector<ll> adj[N], kq;
pll p[N];
ll pw(ll k, ll n)
{
ll total = 1;
for(; n; n >>= 1)
{
if(n & 1)total = total * k % mod;
k = k * k % mod;
}
return total;
}
string s;
bool cmp(pll x, pll y)
{
return (long double) 1.0 * x.se / x.fi > (long double) 1.0 * y.se / y.fi;
}
void sol()
{
cin >> n >> m;
bool ok = false;
if(n < m)
{
swap(n, m);
ok = true;
}
for(int i = 1; i <= n; i ++)
{
for(int j = 1; j <= m; j ++)a[i][j] = 1;
}
for(int j = 1; j <= (m-1)/2; j ++)for(int i = 1; i <= n; i ++)a[i][j] = 0;
cout << n + (m-1)/2 << '\n';
if(ok)swap(n, m);
for(int i = 1; i <= n; i ++)
{
for(int j = 1; j <= m; j ++)
{
if(ok)
{
if(a[j][i])cout << '-';
else cout << '+';
}
else
{
if(a[i][j])cout << '+';
else cout << '-';
}
}
cout << '\n';
}
}
int main()
{
if(fopen(task".in", "r"))
{
freopen(task".in", "r", stdin);
freopen(task".out", "w", stdout);
}
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int ntest = 1;
cin >> ntest;
while(ntest -- > 0)
sol();
}
/*
5
100
12
8
2021
10000
*/
Compilation message
stones.cpp: In function 'int main()':
stones.cpp:71:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
71 | freopen(task".in", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
stones.cpp:72:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
72 | freopen(task".out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
588 KB |
Output is correct |
4 |
Incorrect |
2 ms |
588 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
1872 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 |
2028 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 |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
588 KB |
Output is correct |
4 |
Incorrect |
2 ms |
588 KB |
Wrong answer in test 5 29: 31 < 32 |