#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define maxe *max_element
#define mine *min_element
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define sz(a) (int)a.size()
#define kchau ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const ll INF = 1e18 + 7;
const ll MOD = 1e9 + 7;
const ll BLOCK = 700;
const ll T = 2006;
const ll SP = 2e5 + 7;
const ll N = 1e6 + 7;
using namespace std;
char a[1005][1005];
int main(){
kchau
// freopen("tiles.in", "r", stdin);
// freopen("tiles.out", "w", stdout);
ll t; cin >> t;
while(t--){
ll n, m; cin >> n >> m;
ll res = max(n, m) + (min(n, m) - 1) / 2;
if(n <= m){
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(i == n - 1 && i % 2 == 1){
a[i][j] = '-';
} else if(i % 2 == 0){
a[i][j] = '-';
} else {
a[i][j] = '+';
}
}
}
} else {
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(i == n - 1 && i % 2 == 1){
a[j][i] = '+';
} else if(i % 2 == 0){
a[j][i] = '+';
} else {
a[j][i] = '-';
}
}
}
}
cout << res << '\n';
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << a[i][j];
} cout << '\n';
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
340 KB |
invalid character |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
invalid character |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
340 KB |
invalid character |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
1408 KB |
invalid character |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
1360 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
340 KB |
invalid character |
3 |
Halted |
0 ms |
0 KB |
- |