Submission #223776

# Submission time Handle Problem Language Result Execution time Memory
223776 2020-04-16T12:21:05 Z socho Red-blue table (IZhO19_stones) C++14
0 / 100
83 ms 1400 KB
#include "bits/stdc++.h"
using namespace std;
// #define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;

void solve() {
	
	int x, y;
	cin >> x >> y;
	int A = (x - 1) / 2 + y;
	int B = (y - 1) / 2 + x;
	
	int grid[x][y];
	
	if (A > B) {
		// pick all y columns
		memset(grid, 0, sizeof grid);
		int L = (x-1) / 2;
		for (int i=0; i<L; i++) {
			for (int j=0; j<y; j++) {
				grid[i][j] = 1;
			}
		}
	}
	else {
		// pick all x rows
		memset(grid, 1, sizeof grid);
		int L = (y - 1) / 2;
		for (int i=0; i<x; i++) {
			for (int j=0; j<L; j++) {
				grid[i][j] = 0;
			}
		}
	}
	
	cout << max(A, B) << endl;
	for (int i=0; i<x; i++) {
		for (int j=0; j<y; j++) {
			cout << (grid[i][j] ? '-' : '+');
		}
		cout << endl;
	}
	
}

signed main() {
	
	int t;
	cin >> t;
	while (t--) solve();
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB in the table A+B is not equal to 3
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 384 KB in the table A+B is not equal to 46
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB in the table A+B is not equal to 3
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 1376 KB in the table A+B is not equal to 107
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 1400 KB in the table A+B is not equal to 35
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB in the table A+B is not equal to 3
2 Halted 0 ms 0 KB -