Submission #340789

# Submission time Handle Problem Language Result Execution time Memory
340789 2020-12-28T11:06:58 Z NachoLibre Red-blue table (IZhO19_stones) C++14
11 / 100
33 ms 1388 KB
#include <bits/stdc++.h>
using namespace std;

int t, n, m;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	for(int ti = 1; ti <= t; ++ti) {
		cin >> n >> m;
		if(n == 1) {
			cout << m << "\n";
			for(int i = 1; i <= m; ++i) {
				cout << "-";
			}
			cout << "\n";
		} else if(m == 1) {
			cout << n << "\n";
			for(int i = 1; i <= n; ++i) {
				cout << "+";
				cout << "\n";
			}
		} else {
			int ns = (n - 1) / 2 * 2, ms = (m - 1) / 2 * 2;
			if(max(n + m / 2, m + n / 2) > ns + ms) {
				if(n > m) {
					cout << n + m / 2 << "\n";
					for(int i = 1; i <= n; ++i) {
						for(int j = 1; j <= m; ++j) {
							cout << (j <= m / 2 ? "-" : "+");
						}
						cout << "\n";
					}
				} else {
					cout << m + n / 2 << "\n";
					for(int i = 1; i <= n; ++i) {
						for(int j = 1; j <= m; ++j) {
							cout << (i > n / 2 ? "-" : "+");
						}
						cout << "\n";
					}
				}
			}
			cout << ns + ms << "\n";
			for(int i = 1; i <= n; ++i) {
				for(int j = 1; j <= m; ++j) {
					if(i > ns) {
						cout << "-";
					} else if(j > ms) {
						cout << "+";
					} else {
						cout << (((i + j) & 1) ? "-" : "+");
					}
				}
				cout << "\n";
			}
		}
		#ifdef WEEE
		cout << flush;
		#endif
	}
	cout << flush;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB in the table A+B is not equal to 21
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1388 KB Output is correct
2 Correct 28 ms 1260 KB Output is correct
3 Correct 32 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1388 KB in the table A+B is not equal to 3
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 5