#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "
#define MAX 1000
lli n,m,t,mejor,lim,f,c,b,a,ini;
pair<lli,lli> cant;
char res[MAX+2][MAX+2];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> t;
rep(i,1,t) {
cin >> n >> m;
mejor = 0;
f = n / 2;
f++;
c = m / 2;
c++;
lim = n*m;
repa(i,n,0) {
repa(j,m,0) {
a = i*c;
a += j*f;
b = i + j;
if (a > lim) continue;
if (b <= mejor) break;
mejor = b;
cant = {i,j};
}
}
rep(i,1,n) {
rep(j,1,m) res[i][j] = '-';
}
ini = 1;
rep(i,1,cant.first) {
rep(j,1,c) {
res[ini][i] = '+';
ini++;
if (ini == m+1) ini = 1;
}
}
cout << mejor << "\n";
rep(i,1,n) {
rep(j,1,m) cout << res[i][j];
cout << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
in the table A+B is not equal to 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
328 KB |
in the table A+B is not equal to 46 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
in the table A+B is not equal to 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1344 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 |
20 ms |
1452 KB |
in the table A+B is not equal to 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
in the table A+B is not equal to 4 |
2 |
Halted |
0 ms |
0 KB |
- |