#include <bits/stdc++.h>
using namespace std;
#define io \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
typedef long long ll;
ll bp(ll n,ll m){
if(m == 0){
return 1;
}
if(m == 1){
return n;
}
if(m%2==0){
return bp(n*n,m/2);
}
return n*bp(n,m-1);
}
const int N = 1020, M = 33, inf = 1e9 + 99;
const ll inff = 1e12;
int main()
{
io;
int t;
cin >> t;
while(t--) {
int n , m;
cin >> n >> m;
vector<vector<char>> v(n , vector<char>(m));
char cc = '+';
if(n > m) {
cc = '-';
}
vector<vector<char>> tmp(n , vector<char>(m , cc));
int ans = max(n , m);
int fi[n]={0} , se[m] = {0};
for(int i=0;i<n;i++) {
for(int j=0;j<m/2;j++) {
v[i][j] = '-';
se[j] ++;
}
}
for(int i=0;i<n;i++) {
for(int j=m/2;j<m;j++) {
v[i][j] = '+';
fi[i] ++;
}
}
for(int i=0;i<n;i++) {
for(int j=0;j<m/2;j++) {
if(i%(m/2) == j) {
v[i][j] = '+';
fi[i] ++;
se[j] --;
}
}
}
int res = 0;
for(int i=0;i<n;i++) {
res += (fi[i] > n/2);
}
for(int i=0;i<m;i++) {
res += (se[i] > m/2);
}
if(res < ans) {
res = ans;
v = tmp;
}
cout << res << endl;
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
cout << v[i][j] << " ";
}
cout << endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
74 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4131 ms |
262144 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |