Submission #209914

# Submission time Handle Problem Language Result Execution time Memory
209914 2020-03-16T00:48:51 Z super_j6 Red-blue table (IZhO19_stones) C++14
27 / 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 <= 4)){
		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 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 6 ms 376 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 30 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 32 ms 1400 KB Wrong answer in test 6 6: 8 < 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 6 ms 376 KB Wrong answer in test 5 29: 31 < 32