Submission #342136

# Submission time Handle Problem Language Result Execution time Memory
342136 2021-01-01T12:50:25 Z darkxeon Red-blue table (IZhO19_stones) C++17
0 / 100
38 ms 1772 KB
#include <bits/stdc++.h>
#define sz(x) (long long)x.size()
 
using namespace std;
 
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
 
const int N = 1e5 + 5, M = 1e6 + 7, SM = 1e3 + 5, logN = 20;
const long long MOD = 1e9 + 7, INF = 1e18 + 9;
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};
 
void debug() {
	cerr << "\n";
}
template<typename Head, typename... Tail>
void debug(Head a, Tail... b) {
	cerr << a << " ";
	debug(b...);
}

long long div_ceil(long long a, long long b) {
	return (a + b - 1) / b;
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
		
	long long q; cin >> q;
	
	while(q--) {
		long long n, m, ans = 0; cin >> n >> m;
		
		vector<vector<long long>> a(n, vector<long long>(m));
		
		vector<long long> rows(n), cols(m);
		for(long long i = 0; i < n; i++) {
			for(long long j = 0; j < m; j++) {
				if(i < div_ceil(n, 2) - 1) {
					a[i][j] = 1;
					rows[i]++;
				}
				else {
					a[i][j] = 0;
					cols[j]++;
				}
			}
		}
		
		for(long long i = 0; i < n; i++) {
			if(rows[i] >= m / 2 + 1) {
				ans++;
			}
		}
		for(long long j = 0; j < m; j++) {
			if(cols[j] >= n / 2 + 1) {
				ans++;
			}
		}
		
		cout << ans << "\n";
		for(long long i = 0; i < n; i++) {
			for(long long j = 0; j < m; j++) {
				cout << (a[i][j] ? '+' : '-');
			}
			cout << "\n";
		}
	}	
	
	cout << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 1644 KB Wrong answer in test 97 21: 69 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 1772 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 364 KB Output is correct
2 Incorrect 1 ms 364 KB Wrong answer in test 2 1: 1 < 2