This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define N 100005
#define ccin cin >>
#define ccout cout <<
using namespace std;
char a[2000][2000];
int col[2000];
int row[2000];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
ccin t;
while(t--){
int n, m;
ccin n >> m;
int ans = max(n, m);
if(n > m){
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
a[i][j] = '+';
row[i] = m;
}
}
int cnt = 0;
for(int i = 0; i < m; i++){
int l = 0;
for(int j = 0; j < n; j++){
if(l >= n / 2 + 1){
break;
}
if(row[cnt] - 1 >= m / 2 + 1){
a[cnt][i] = '-';
row[cnt]--;
l++;
}
cnt++;
cnt %= n;
}
if(l == n / 2 + 1){
ans++;
}
}
}
else{
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
a[i][j] = '-';
col[j] = n;
}
}
int cnt = 0;
for(int i = 0; i < n; i++){
int l = 0;
for(int j = 0; j < m; j++){
if(l >= m / 2 + 1){
break;
}
if(col[cnt] - 1 >= n / 2 + 1){
a[i][cnt] = '+';
col[cnt]--;
l++;
}
cnt++;
cnt %= m;
}
if(l == m / 2 + 1){
ans++;
}
}
}
ccout ans << endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
ccout a[i][j];
}
ccout endl;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |