Submission #209954

# Submission time Handle Problem Language Result Execution time Memory
209954 2020-03-16T04:13:57 Z super_j6 Red-blue table (IZhO19_stones) C++14
15 / 100
37 ms 3192 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

int n, m;
bool f;

void answer(){
	cin >> n >> m;
	
	if(n < m){
		swap(n, m);
		f = 1;
	}else f = 0;
	
	int a[n][m];
	memset(a, 0, sizeof(a));
	for(int i = 0; i < (m - 1) / 2; i++)
	for(int j = 0; j < n; j++){
		a[j][(i * n + j) / (n / 2 + 1)] = 1;
	}
	
	if(f) swap(n, m);
	cout << (n + ((m - 1) / 2 * n) / (n / 2 + 1)) << endl;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cout << ((f ? !a[j][i] : a[i][j]) ? '-' : '+');
		}
		cout << endl;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int t;
	cin >> t;
	
	for(int i = 0; i < t; i++) answer();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 380 KB in the table A+B is not equal to 36
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 1400 KB in the table A+B is not equal to 76
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1400 KB Output is correct
2 Correct 31 ms 3192 KB Output is correct
3 Correct 27 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -