Submission #169130

# Submission time Handle Problem Language Result Execution time Memory
169130 2019-12-18T14:01:56 Z Nodir_Bobiev Red-blue table (IZhO19_stones) C++14
27 / 100
95 ms 1400 KB
# include <bits/stdc++.h>
# define FILE
using namespace std;

int main(){

	# ifdef FILEs	
		freopen( "input.txt", "r", stdin );
		freopen( "output.txt", "w", stdout );
	# endif

	int t;
	cin >> t;
	while( t -- ){
		int n, m;
		cin >> n >> m;
		char a[n][m];
		int ans = 0;
		if( n < m ){
			ans = m + (n-1)/2;
			for( int i = 0; i < n; i ++ )
				for( int j = 0; j < m; j ++ )
					a[i][j] = '-';
			for( int i = 0; i < (n-1)/2; i ++ )
				for( int j = 0; j < m; j ++ )	
					a[i][j] = '+';
		}
		else{
			ans = n + (m-1)/2;
			for( int i = 0; i < n;  i++ )
				for( int j = 0; j < m; j ++ )
					a[i][j] = '+';
			for( int j = 0; j < (m-1)/2; j ++ )
				for( int i = 0; i < n; i ++ )
					a[i][j] = '-';
		}
		cout << ans << endl;
		for( int i = 0; i < n; i ++ ){
			for( int j = 0; j < m; j ++ ){
				cout << a[i][j];
			}cout << endl;
		}

	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Incorrect 23 ms 376 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 95 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 69 ms 1272 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Incorrect 23 ms 376 KB Wrong answer in test 5 29: 31 < 32