#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define Kultivator ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const LL Mxn = 1e6 + 7;
const LL Mod = 1e9 + 7;
const LL Inf = 1e14 + 7;
int N, M;
int S[1001], A[1001][1001];
void Solve(){
int Ans = 0;
bool Inv = false;
if(M < N){
swap(N, M);
Inv = true;
}
Ans += M;
for(int i = 0; i < M; i++){
S[i] = -N;
}
for(int i = 0; i < N; i++){
vector <pair <int, int>> V;
for(int j = 0; j < M; j++){
A[i][j] = false;
V.pb({S[j], j});
}
sort(V.begin(), V.end());
bool Check = false;
for(int j = 0; j < (M / 2) + 1; j++){
if(V[j].first + 2 >= 0) Check = true;
}
if(!Check){
Ans++;
for(int j = 0; j < (M / 2) + 1; j++){
A[i][V[j].second] = true;
}
}
}
cout << Ans << '\n';
if(!Inv){
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
if(!A[i][j]) cout << '-';
else cout << '+';
}
cout << '\n';
}
} else {
for(int i = 0; i < M; i++){
for(int j = 0; j < N; j++){
if(A[i][j]) cout << '-';
else cout << '+';
}
cout << '\n';
}
}
}
int main() {
Kultivator;
int tt;
cin >> tt;
while(tt--){
cin >> N >> M;
Solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
in the table A+B is not equal to 48 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
1772 KB |
in the table A+B is not equal to 118 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
1900 KB |
in the table A+B is not equal to 48 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 6 |
2 |
Halted |
0 ms |
0 KB |
- |