Submission #856758

# Submission time Handle Problem Language Result Execution time Memory
856758 2023-10-04T12:58:40 Z Halym2007 Red-blue table (IZhO19_stones) C++11
11 / 100
23 ms 2132 KB
#include <iostream>
#include <algorithm>
#include <math.h>
//#include <vector>
//#include <stack>
//#include <queue>
//#include <map>
//#include <set>
//#include <deque>
#define ll long long
#define sz(s) (int)s.size()
#define N 200005
#define ff first
#define ss second
using namespace std;
int T, n, m;
char c[1005][1005];
int main()
{
	cin >> T;
	while(T--){
		cin >> n >> m;
		if(n == 1){
			cout << m << '\n';
			for(int i = 1; i <= m; i++){
				cout << '-';
			}
			cout << '\n';
			continue;
		}
		else if(m == 1){
			cout << n << '\n';
			for(int i = 1; i <= n; i++){
				cout << '+' << '\n';
			}
			continue;
		}
		else {
			cout << n+m-2 << '\n';
		}
		for(int i = 1; i <= n; i += 2){
			for(int j = 1; j <= m; j++){
				if(j % 2 == 1) c[i][j] = '+';
				else c[i][j] = '-';
			}
		}
		for(int i = 2; i <= n; i += 2){
			for(int j = 1; j <= m; j++){
				if(j % 2 == 1) c[i][j] = '-';
				else c[i][j] = '+';
			}
		}
		for(int i = 1; i <= m; i++){
			c[n][i] = '-';
		}
		for(int i = 1; i <= n; i++){
			c[i][m] = '+';
		}
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= m; j++){
				cout << c[i][j];
			}
			cout << '\n';
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB in the table A+B is not equal to 4
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB in the table A+B is not equal to 20
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB in the table A+B is not equal to 4
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1396 KB Output is correct
2 Correct 20 ms 1876 KB Output is correct
3 Correct 19 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1372 KB in the table A+B is not equal to 46
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB in the table A+B is not equal to 4
3 Halted 0 ms 0 KB -