/* Speech to the young */
//#include <bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define YOSIK() ios_base::sync_with_stdio(0),cin.tie(0)
#define int long long
#define pans cout << "\n------ans-------\n"
const int N = 1e6 + 10;
const int INF = 1e18 + 7;
const int MOD = 1e9 + 7;
const int P = 31;
int n, m;
void Solution () {
cin >> n >> m;
if (n <= m) {
cout << (n >= 3 ? 1 : 0) + m << '\n';
for (int i = 1; i <= n; ++ i) {
for (int j = 1; j <= m; ++ j) {
if (i <= max (2ll, n - 1)) cout << "-";
else cout << '+';
}
cout << '\n';
}
} else {
cout << (m >= 3 ? 1 : 0) + n << '\n';
for (int i = 1; i <= n; ++ i) {
for (int j = 1; j <= m; ++ j) {
if (j <= max (2ll, m - 1)) cout << "+";
else cout << '-';
}
cout << '\n';
}
}
return;
}
signed main () {
YOSIK();
// precalc();
int T = 1;
cin >> T;
while (T --) Solution ();
exit (0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
340 KB |
Wrong answer in test 5 29: 30 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
1252 KB |
Wrong answer in test 97 21: 98 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
1356 KB |
Wrong answer in test 24 24: 25 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
340 KB |
Wrong answer in test 5 29: 30 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |