Submission #855891

# Submission time Handle Problem Language Result Execution time Memory
855891 2023-10-02T06:56:50 Z Halym2007 Red-blue table (IZhO19_stones) C++11
27 / 100
49 ms 1364 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
char jog[N][N];
int main () {
//	freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	while ( t-- ) {
		int n, m, jogap = 0;
		cin >> n >> m;
		if (min(n, m) == 1) {
			char c;
			if (n == 1) c = '-';
			else c = '+';
			jogap = max (n, m);
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m; ++j) {
					jog[i][j] = c;
				}
			}
		}
		else if (n >= m) {
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m; ++j) {
					jog[i][j] = '1';
				}
			}
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m / 2 + 1; ++j) {
					jog[i][j] = '+';
				}
			}
			jogap = n + (m - (m / 2 + 1));
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m; ++j) {
					if (jog[i][j] == '1') jog[i][j] = '-';
				}
			}
		}
		else {
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m; ++j) {
					jog[i][j] = '1';
				}
			}
			for (int i = 1; i <= m; ++i) {
				for (int j = 1; j <= n / 2 + 1; ++j) {
					jog[j][i] = '-';
				}
			}
			jogap = m + (n - (n / 2 + 1));
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m; ++j) {
					if (jog[i][j] == '1') jog[i][j] = '+';
				}
			}
		}
		cout << jogap << endl;
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= m; ++j) {
				cout << jog[i][j];
			}
			cout << endl;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Incorrect 9 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 1364 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1360 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Incorrect 9 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -