Submission #209909

# Submission time Handle Problem Language Result Execution time Memory
209909 2020-03-16T00:34:41 Z super_j6 Red-blue table (IZhO19_stones) C++14
0 / 100
32 ms 1400 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

int n, m;

void answer(){
	cin >> n >> m;
	
	int t;
	if(n < m){
		t = (n - 1) / 2;
		cout << (m + t) << endl;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				cout << (i < t ? '+' : '-');
			}
			cout << endl;
		}
	}else if(n > m || (n == m && n % 2 == 0)){
		t = (m - 1) / 2;
		cout << (n + t) << endl;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				cout << (j < t ? '-' : '+');
			}
			cout << endl;
		}
	}else{
		t = (n - 1) / 2;
		cout << (4 * t) << endl;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				if(i < t && j < m - t) cout << '+';
				else if(i > n - t - 1 && j > t - 1) cout << '+';
				else cout << '-';
			}
			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 Correct 5 ms 376 KB Output is correct
2 Incorrect 4 ms 376 KB in the table A+B is not equal to 0
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB in the table A+B is not equal to 0
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 4 ms 376 KB in the table A+B is not equal to 0
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1400 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1400 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 4 ms 376 KB in the table A+B is not equal to 0