# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769980 | 2023-06-30T15:36:05 Z | rainboy | Red-blue table (IZhO19_stones) | C | 11 ms | 2208 KB |
#include <stdio.h> #define N 1000 #define M 1000 int min(int a, int b) { return a < b ? a : b; } int main() { int t; scanf("%d", &t); while (t--) { static char cc[N][M + 1]; int n, m, i, j, a, b, a_, b_; scanf("%d%d", &n, &m); a_ = b_ = 0; for (a = 0; a <= n; a++) { b = a <= (n - 1) / 2 ? m : min(a * ((m - 1) / 2) / (a - (n - 1) / 2), m); if (a_ + b_ < a + b) a_ = a, b_ = b; } for (i = 0; i < n; i++) { for (j = 0; j < m; j++) if (j >= b_) cc[i][j] = '+'; else if (i >= a_) cc[i][j] = '-'; else cc[i][j] = (j - (b_ - (m - 1) / 2) * i % b_ + b_) % b_ < b_ - (m - 1) / 2 ? '+' : '-'; cc[i][m] = 0; } printf("%d\n", a_ + b_); for (i = 0; i < n; i++) printf("%s\n", cc[i]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1352 KB | Output is correct |
2 | Correct | 10 ms | 1876 KB | Output is correct |
3 | Correct | 10 ms | 2004 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 1344 KB | Output is correct |
2 | Correct | 9 ms | 1804 KB | Output is correct |
3 | Correct | 8 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 10 ms | 1352 KB | Output is correct |
6 | Correct | 10 ms | 1876 KB | Output is correct |
7 | Correct | 10 ms | 2004 KB | Output is correct |
8 | Correct | 11 ms | 1344 KB | Output is correct |
9 | Correct | 9 ms | 1804 KB | Output is correct |
10 | Correct | 8 ms | 1492 KB | Output is correct |
11 | Correct | 3 ms | 468 KB | Output is correct |
12 | Correct | 9 ms | 1748 KB | Output is correct |
13 | Correct | 9 ms | 1876 KB | Output is correct |
14 | Correct | 7 ms | 1600 KB | Output is correct |
15 | Correct | 11 ms | 2208 KB | Output is correct |
16 | Correct | 9 ms | 1748 KB | Output is correct |
17 | Correct | 5 ms | 1196 KB | Output is correct |