# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342285 | 2021-01-01T17:46:10 Z | _ani | Red-blue table (IZhO19_stones) | C++17 | 47 ms | 1516 KB |
#include <iostream> #include <algorithm> using namespace std; char s[1002][1002]; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) s[i][j] = '+'; int A, B, ans; if (n > m) { A = n; B = 0; ans = n; } else { A = 0; B = m; ans = m; } for (int a = 1; a <= n; a++) { int k = (n + 1) / 2 - (n - a); if (k == 0) { if (a + m > ans) ans = a + m; A = a; B = m; continue; } int b = (m / 2) * a / k; while (k * b / a + ((k * b) % a ? 1 : 0) > m / 2) b--; if (a + b > ans) ans = a + b; A = a; B = b; } int i = 0, j = 0; int k = (n + 1) / 2 - (n - A); while (i < B) { int cnt = 0; while (cnt < k) { s[j][i] = '-'; j++; if (j >= A) j = 0; cnt++; } i++; } for (int i = 0; i < B; i++) for (int j = A; j < n; j++) s[j][i] = '-'; cout << ans << '\n'; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cout << s[i][j]; cout << '\n'; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | in the table A+B is not equal to 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | in the table A+B is not equal to 46 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | in the table A+B is not equal to 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 47 ms | 1412 KB | in the table A+B is not equal to 539 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 44 ms | 1516 KB | in the table A+B is not equal to 169 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | in the table A+B is not equal to 3 |
2 | Halted | 0 ms | 0 KB | - |