# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167719 | munhorgil | Red-blue table (IZhO19_stones) | C++14 | 93 ms | 1272 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;
int main()
{
int t , i , j , m , n , ans , a , b;
cin >> t;
while(t > 0)
{
cin >> n >> m;
if(n > 2)
{
if(n % 2 == 0) a = n - 2;
else a = n - 1;
}
if(m > 2)
{
if(m % 2 == 0) b = m - 2;
else b = m - 1;
}
if(n == 1)
{
a = 0;
cout << m << endl;
goto here;
}
if(m == 1)
{
cout << n << endl;
for(i = 0 ; i < n ; i++)
{
cout << "+" << endl;
}
goto there;
}
if(n == 2)
{
a = 0;
cout << m << endl;
goto here;
}
if(m == 2)
{
cout << n << endl;
for(i = 0 ; i < n ; i++)
{
cout << "++" << endl;
}
goto there;
}
ans = a + b;
cout << ans << endl;
for(j = 0 ; j < a / 2 ; j++)
{
for(i = 0 ; i < b / 2 ; i++)
{
cout << "+";
}
for(i = 0 ; i < b / 2 ; i++)
{
cout << "-";
}
for(i = 0 ; i < (m - b) ; i++)
{
cout << "+";
}
cout << endl;
}
for(j = 0 ; j < a / 2 ; j++)
{
for(i = 0 ; i < b / 2 ; i++)
{
cout << "-";
}
for(i = 0 ; i < b / 2 ; i++)
{
cout << "+";
}
for(i = 0 ; i < (m - b) ; i++)
{
cout << "+";
}
cout << endl;
}
here:;
for(j = 0 ; j < (n - a) ; j++)
{
for(i = 0 ; i < m ; i++)
{
cout << "-";
}
cout << endl;
}
there:;
t--;
}
}
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... |