Submission #342313

# Submission time Handle Problem Language Result Execution time Memory
342313 2021-01-01T20:27:37 Z _ani Red-blue table (IZhO19_stones) C++17
0 / 100
45 ms 1388 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
char s[1002][1002];
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m;
		cin >> n >> m;
		if (min(n, m) > 2)
		{
			int ans = n + m - 2;
			if (n % 2 == 0)ans--;
			if (m % 2 == 0)ans--;
			cout << ans << '\n';
			int a = n, b = m;
			if (a % 2)a--;
			else a -= 2;
			if (b % 2)b--;
			else b -= 2;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++)
				{
					if (i < a / 2 && j < b / 2)
						cout << '-';
					else if (i >= a / 2 && i < a && j >= b / 2 && j < b)
						cout << '-';
					else if (i >= a)
						cout << '-';
					else if (j >= b)
						cout << '+';
					else cout << '+';
				}
				cout << '\n';
			}
		}
		else
		{
			cout << max(m, n) << '\n';
			char d;
			if (m > n)
				d = '-';
			else d = '+';
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < m; j++)
					cout << '-';
				cout << '\n';
			}
		}
	}
	return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:44:9: warning: variable 'd' set but not used [-Wunused-but-set-variable]
   44 |    char d;
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 2
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB in the table A+B is not equal to 2
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 2
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1388 KB in the table A+B is not equal to 87
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 1388 KB Wrong answer in test 4 4: 4 < 5
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 2