#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define debug(x...)
#endif
int T, m, n;
void solve() {
cin >> m >> n;
if (m > n) {
cout << m + (n - 1) / 2 << '\n';
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= (n - 1) / 2; j++)
cout << '-';
for (int j = (n - 1) / 2 + 1; j <= n; j++)
cout << '+';
cout << '\n';
}
} else {
cout << n + (m - 1) / 2 << '\n';
for (int i = 1; i <= (m - 1) / 2; i++) {
for (int j = 1; j <= n; j++)
cout << '+';
cout << '\n';
}
for (int i = (m - 1) / 2 + 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
cout << '-';
cout << '\n';
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#ifdef DEBUG
freopen("../_input", "r", stdin);
#endif
cin >> T;
while (T--)
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
2 ms |
324 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
1344 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
1244 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
2 ms |
324 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |