Submission #498581

#TimeUsernameProblemLanguageResultExecution timeMemory
498581The_SamuraiRed-blue table (IZhO19_stones)C++98
0 / 100
63 ms1540 KiB
#include <bits/stdc++.h>
 
using namespace std;

/*

6 6
++++--
------
------
--++++
--++++
7 7
++++---
++++---
++++---
---+---
---++++
---++++
---++++
*/

void solve() {
	int n, m;
	
	cin >> n >> m;
	if (n == 1) {
		cout << "1\n+\n";
		return;
	}
	if (n % 2 == 0) {
		int x = 1 - n % 2;
		cout << n + (n / 2 - x) << '\n';
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m / 2 + m % 2 + x; j++) {
				cout << '+';
			}
			for (int j = m / 2 + m % 2 + x; j < m; j++) {
				cout << '-';
			}
			cout << '\n';
		}
		return;
	}
	cout << 2 * n - 2 << '\n';
	for (int i = 0; i < n / 2; i++) {
		for (int j = 0; j < n / 2 + n % 2; j++) {
			cout << '+';
		}
		for (int j = n / 2 + n % 2; j < n; j++) {
			cout << '-';
		}
		cout << '\n';
	}
	for (int i = 0; i < n; i++) {
		cout << '-';
	}
	cout << '\n';
	for (int i = 0; i < n / 2; i++) {
		for (int j = 0; j < n / 2 ; j++) {
			cout << '-';
		}
		for (int j = n / 2; j < n; j++) {
			cout << '+';
		}
		cout << '\n';
	}
}
 
int main() {
	int t;
	
	cin >> t;
	while (t--) {
		solve();
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...