//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <cmath>
using namespace std;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
typedef long long ll;
typedef long double ld;
const ll SZ = 1e6 + 100, INF = 1e9, AM = 2, K = 26;
const vector<ll> P = { 1774, 177 };
const vector<ll> MOD = { ll(1e9 + 7), ll(1e9 + 9) };
ll n, m;
signed main() {
fastInp;
ll t;
cin >> t;
while (t--) {
cin >> n >> m;
if (m <= n) {
cout << n + (m - 1) / 2 << "\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if ((j + 1) * 2 < m) {
cout << "-";
} else {
cout << "+";
}
}
cout << "\n";
}
} else {
cout << m + (n - 1) / 2 << "\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (i == n - 1 && (n % 2) == 0) {
cout << "-";
continue;
}
if (i % 2 == 0) {
cout << "-";
} else {
cout << "+";
}
}
cout << "\n";
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
2 ms |
332 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
1272 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1240 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
2 ms |
332 KB |
Wrong answer in test 5 29: 31 < 32 |