Submission #218315

# Submission time Handle Problem Language Result Execution time Memory
218315 2020-04-02T00:40:26 Z Lawliet Red-blue table (IZhO19_stones) C++17
27 / 100
53 ms 1528 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1010;

int n, m;

char ans[MAXN][MAXN];
char aux[MAXN][MAXN];

int main()
{
	int t;
	scanf("%d",&t);

	for(int k = 0 ; k < t ; k++)
	{
		scanf("%d %d",&n,&m);

		bool wasSwaped = false;

		if( n > m )
		{
			swap( n , m );
			wasSwaped = true;
		}

		printf("%d\n",n + m - (n + 2)/2);

		for(int i = 1 ; i <= n - (n + 2)/2 ; i++)
			for(int j = 1 ; j <= m ; j++)
				ans[i][j] = '+';

		for(int i = n - (n + 2)/2 + 1 ; i <= n ; i++)
			for(int j = 1 ; j <= m ; j++)
				ans[i][j] = '-';

		if( wasSwaped )
		{
			for(int i = 1 ; i <= n ; i++)
				for(int j = 1 ; j <= m ; j++)
					aux[i][j] = ans[i][j];

			for(int i = 1 ; i <= m ; i++)
				for(int j = 1 ; j <= n ; j++)
					ans[i][j] = '+' + '-' - aux[j][i];

			swap( n , m );
		}

		for(int i = 1 ; i <= n ; i++, printf("\n"))
			for(int j = 1 ; j <= m ; j++)
				printf("%c",ans[i][j]);
	}
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&t);
  ~~~~~^~~~~~~~~
stones.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n,&m);
   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Incorrect 7 ms 384 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 1528 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 1528 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 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Incorrect 7 ms 384 KB Wrong answer in test 5 29: 31 < 32