# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
494855 | 2021-12-16T20:42:17 Z | Amer | Red-blue table (IZhO19_stones) | C++14 | 44 ms | 1380 KB |
#include <iostream> using namespace std; const int maxN = 1005; bool marked[maxN][maxN]; int num[maxN]; int solve(int n, int m) { int midN = n / 2 + 1; int midM = m / 2 + m % 2 - 1; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { marked[i][j] = 0; } num[i] = 0; } int sum = n; int pointer = 1; for (int i = 1; i <= m; i++) { int steps; bool full = false; for (steps = 1; steps <= midN; steps++) { if (num[pointer] >= midM) { full = true; break; } marked[i][pointer] = true; num[pointer]++; pointer++; if (pointer > n) { pointer = 1; } } if (steps >= midN + 1) { sum++; } if(full) { break; } } cout << sum << endl; return 0; } void test(int n, int m) { int sum = 0; if (n > m) { sum = solve(n, m); int place = 0; for (int i = 1; i <= n; i++) { for (int j = m; j >= 1; j--) { if (marked[i][j]) { cout << "+"; } else { cout << "-"; } } cout << endl; } } else { sum = solve(m, n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (marked[i][j]) { cout << "+"; } else { cout << "-"; } } cout << endl; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; for (int i = 0; i < t; i++) { int n, m; cin >> n >> m; test(n, m); } return 0; } ///5 6
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 324 KB | in the table A+B is not equal to 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 332 KB | in the table A+B is not equal to 8 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 324 KB | in the table A+B is not equal to 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 44 ms | 1380 KB | in the table A+B is not equal to 116 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 1356 KB | in the table A+B is not equal to 20 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 324 KB | in the table A+B is not equal to 2 |