Submission #202868

# Submission time Handle Problem Language Result Execution time Memory
202868 2020-02-18T12:39:35 Z luciocf Red-blue table (IZhO19_stones) C++14
27 / 100
63 ms 1528 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e3+10;

char tab[maxn][maxn];

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

	while (t--)
	{
		int n, m;
		scanf("%d %d", &n, &m);

		int mx = 0, ind = 1;

		for (int A = 0; A <= n; A++)
		{
			int qtd = (m+2)/2;
			int B = m-qtd;

			if (n-A >= (n+2)/2) B = m;

			if (A+B > mx)
				mx = A+B, ind = A;
		}

		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= m; j++)
			{
				if (i <= ind && j <= (m+2)/2)
					tab[i][j] = '+';
				else
					tab[i][j] = '-';
			}
		}

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

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &t);
  ~~~~~^~~~~~~~~~
stones.cpp:17: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 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 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 6 ms 376 KB Output is correct
4 Incorrect 8 ms 376 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 63 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 62 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 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Incorrect 8 ms 376 KB Wrong answer in test 5 29: 31 < 32