#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC
#define fi first
#define se second
#define ll long long int
#define dl double long
using namespace std;
const int N = 1e6 + 7;
const ll INF = 1e10 + 7;
const int mod = 998244353;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve1()
{
int n, m;
char a = '+', b = '-';
bool f = false;
cin >> n >> m;
if(n < m){
swap(n, m);
swap(a, b);
f = true;
}
int k = (m * n) - (m / 2 + 1) * n;
cout << n + k / ((n + 1) / 2) << endl;
char ar[n][m];
for(int i = 0; i < k / n && f; i++){
for(int j = 0; j < m; j++){
ar[i][j] = b;
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < k / m && !f; j++){
ar[i][j] = b;
}
}
for(int i = 0; i < n * !f + m * f; i++){
for(int j = 0; j < m * !f + n * f; j++){
if(ar[i][j] != b){
cout << a;
}else{
cout << b;
}
}
cout << endl;
}
}
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0); srand(time(0));
//freopen( "input.txt" , "r" , stdin );
//freopen( "output.txt" , "w" , stdout );
//freopen( "cupboard.in" , "r" , stdin );
//freopen( "cupboard.out" , "w" , stdout );
int cghf = 1;cin >> cghf;
while( cghf-- ){
solve1();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
512 KB |
in the table A+B is not equal to 6 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
364 KB |
in the table A+B is not equal to 46 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
512 KB |
in the table A+B is not equal to 6 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
17 ms |
876 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
59 ms |
1388 KB |
in the table A+B is not equal to 46 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
512 KB |
in the table A+B is not equal to 6 |