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>
using namespace std;
int main()
{
int q , n , m;
cin >> q;
while(q--){
cin >> n >> m;
int v[n + 1] = {0}, ans = m , k;
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 <= n; i++){
for(int j = 1; j <= m; j++){
if(v[j] < n / 2){
a[i][j] = '+';
v[j]++;
}
}
}
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 |
---|
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... |