#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int q , n , m;
cin >> q;
while(q--){
cin >> n >> m;
int ans = m , k;
vector<pair<int , int>> v(m + 1);
int line[n + 1] = {0};
char a[n + 5][m + 5];
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
a[i][j] = '-';
}
}
for(int i = 1; i <= m; i++){
v[i].second = i;
}
int l = 1;
while(l <= n){
for(int r = 1; r <= m; r++){
if(v[r].first + 1 < (n + 1 ) / 2 && line[l] <= m / 2){
a[l][v[r].second] = '+';
v[r].first++;
line[l]++;
}
}
l++;
}
for(int i = 1; i <= n; i++){
k = 0;
for(int j = 1; j <= n; j++){
if(a[i][j] == '+') k++;
}
if(k > m / 2) ans++;
}
cout << ans << endl;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cout << a[i][j];
}
cout << endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Wrong answer in test 2 1: 1 < 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
376 KB |
in the table A+B is not equal to 45 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Wrong answer in test 2 1: 1 < 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
1360 KB |
in the table A+B is not equal to 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
1272 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Wrong answer in test 2 1: 1 < 2 |