#include<bits/stdc++.h>
#define ll int
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,m,ind,ned1,ned2,ans,indx,indy;
char a[1005][1005];
int main(){
ios::sync_with_stdio(false);
int t;
cin >> t;
while(t--){
cin >> n >> m;
ned1 = (m + 2) / 2;
ned2 = (n + 2) / 2;
ans = 0;
for(int i=0; i<=n; i++){
int l=0,r=m,mid;
ind = 0;
while(r >= l){
mid = (l + r) / 2;
if(i * (mid - ned1 + (m - mid)) >= mid * (ned2 - (n - i))){
l = mid + 1;
ind = mid;
}
else {
r = mid - 1;
}
}
if(i + ind > ans){
ans = i + ind;
indx = i;
indy = ind;
}
}
cout << ans << " " << indx << " " << indy << endl;;
for(int i=indx+1; i<=n; i++)
for(int j=1; j<=m; j++)
a[i][j] = '-';
for(int j=indy + 1; j<=m; j++)
for(int i=1; i<=n; i++)
a[i][j] = '+';
int k = indy - ned1 + (m - indy),p;
if(k <= 0){
for(int i=1; i<=indx; i++)
for(int j=1; j<=indy; j++)
a[i][j] ='+';
}
else {
int l = 1;
for(int i=1; i<=indx; i++)
for(int j=1; j<=indy; j++)
a[i][j] = '+';
for(int i=1; i<=indx; i++){
p = k;
while(p--){
a[i][l] = '-';
l++;
if(l == indy + 1)
l = 1;
}
}
}
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 |
Incorrect |
2 ms |
376 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
380 KB |
Wrong answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
86 ms |
1400 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
1420 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |