# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218315 | Lawliet | Red-blue table (IZhO19_stones) | C++17 | 53 ms | 1528 KiB |
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;
const int MAXN = 1010;
int n, m;
char ans[MAXN][MAXN];
char aux[MAXN][MAXN];
int main()
{
int t;
scanf("%d",&t);
for(int k = 0 ; k < t ; k++)
{
scanf("%d %d",&n,&m);
bool wasSwaped = false;
if( n > m )
{
swap( n , m );
wasSwaped = true;
}
printf("%d\n",n + m - (n + 2)/2);
for(int i = 1 ; i <= n - (n + 2)/2 ; i++)
for(int j = 1 ; j <= m ; j++)
ans[i][j] = '+';
for(int i = n - (n + 2)/2 + 1 ; i <= n ; i++)
for(int j = 1 ; j <= m ; j++)
ans[i][j] = '-';
if( wasSwaped )
{
for(int i = 1 ; i <= n ; i++)
for(int j = 1 ; j <= m ; j++)
aux[i][j] = ans[i][j];
for(int i = 1 ; i <= m ; i++)
for(int j = 1 ; j <= n ; j++)
ans[i][j] = '+' + '-' - aux[j][i];
swap( n , m );
}
for(int i = 1 ; i <= n ; i++, printf("\n"))
for(int j = 1 ; j <= m ; j++)
printf("%c",ans[i][j]);
}
}
Compilation message (stderr)
# | 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... |