Submission #502049

# Submission time Handle Problem Language Result Execution time Memory
502049 2022-01-05T07:09:33 Z Mazaalai Red-blue table (IZhO19_stones) C++17
15 / 100
49 ms 1820 KB
#include <bits/stdc++.h> 
#define pb push_back
#define ALL(x) x.begin(),x.end()
using namespace std;
int n, m;
string s = "+-";
const int N = 1e3+1;
char ans[N][N];
void go() {
	bool flip = 0;
	cin >> n >> m;
	if (n > m) {
		flip = 1;
		swap(n, m);
		reverse(ALL(s));
	}
	for (int i = 0; i < n; i++)
	for (int j = 0; j < m; j++) ans[i][j] = s[1];
	int changeCnt = m * ((n-1)/2), curLine = 0, curPick = 0;
	for (int i = 0; changeCnt>0; i++) {
		ans[curLine][i%m] = s[0];
		changeCnt--, curPick++;
		if (curPick*2 > m) {
			curLine++;
			curPick = 0;
		}
	}
	cout << m + curLine <<'\n';
	if (flip) swap(n, m);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) cout << (flip ? ans[j][i] : ans[i][j]);
		cout << '\n';
	}
}
signed main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	int T; cin >> T;
	while(T--) go();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 300 KB in the table A+B is not equal to 4
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB in the table A+B is not equal to 20
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 300 KB in the table A+B is not equal to 4
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 1280 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 49 ms 1312 KB Output is correct
2 Correct 33 ms 1820 KB Output is correct
3 Correct 26 ms 1596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 300 KB in the table A+B is not equal to 4