Submission #503119

# Submission time Handle Problem Language Result Execution time Memory
503119 2022-01-07T09:54:13 Z AzamatRustamov Red-blue table (IZhO19_stones) C++14
15 / 100
23 ms 1576 KB
#include <iostream>
using namespace std;

void solve()
{
	int n, m;
	cin >> n >> m;
	bool swapped = false;
	if (n < m)
	{
		int t = n;
		n = m, m = t, swapped = true;
	}
	char a[n][m];
	for (int i=0; i<n; i++) for (int j=0; j<m; j++) a[i][j] = '+';
	int ans = n, x = 0, c = 0;
	for (int k=0; k<(m-1)/2; k++) for (int y=0; y<n; y++)
	{
		a[y][x] = '-', c++;
		if (c == n/2+1) x++, c=0, ans++;
	}
	cout << ans << '\n';
	if (!swapped) for (int i=0; i<n; i++)
	{
		for (int j=0; j<m; j++) cout << a[i][j];
		cout << '\n';
	}
	else for (int j=0; j<m; j++)
	{
		for (int i=0; i<n; i++) cout << (a[j][i]=='+'?'-':'+');
		cout << '\n';
	}
}

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB in the table A+B is not equal to 46
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 1248 KB in the table A+B is not equal to 78
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1236 KB Output is correct
2 Correct 18 ms 1576 KB Output is correct
3 Correct 16 ms 1324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 5