Submission #167843

# Submission time Handle Problem Language Result Execution time Memory
167843 2019-12-10T12:43:04 Z munhorgil Red-blue table (IZhO19_stones) C++14
38 / 100
93 ms 1332 KB
#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 > 4 && m > 4)
		{
			if(n % 2 == 0) a = n - 2;
				else a = n - 1;	
			if(m % 2 == 0) b = m - 2;
				else b = m - 1;
			
			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;
			}
			for(j = 0 ; j < (n - a) ; j++)
			{
				for(i = 0 ; i < m ; i++)
				{
					cout << "-";
				}
				cout << endl;
			}
		}
		else
		{
			ans = max(n , m) + (min(n , m) - 1) / 2;
			
			cout << ans << endl;
			
			if(n > m)
			{
				for(i = 0 ; i < n ; i++)
				{
					for(j = 0 ; j < m - ((m - 1) / 2) ; j++)
					{
						cout << '+';
					}
					for(j = 0 ; j < (m - 1) / 2 ; j++)
					{
						cout << '-';
					}
					cout << endl;
				}
			}
			else
			{
				for(i = 0 ; i < n - ((n - 1) / 2) ; i++)
				{
					for(j = 0 ; j < m ; j++)
					{
						cout << '-';
					}
					cout << endl;
				}
				for(i = 0 ; i < (n - 1) / 2 ; i++)
				{
					for(j = 0 ; j < m ; j++)
					{
						cout << '+';
					}
					cout << endl;
				}
			}
		}
		
		t--;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Incorrect 23 ms 376 KB Wrong answer in test 38 5: 40 < 41
# Verdict Execution time Memory Grader output
1 Correct 93 ms 1272 KB Output is correct
2 Correct 40 ms 1272 KB Output is correct
3 Correct 39 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 1332 KB Wrong answer in test 6 6: 8 < 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Incorrect 23 ms 376 KB Wrong answer in test 38 5: 40 < 41