# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
830048 | 2023-08-18T17:58:57 Z | vjudge1 | Red-blue table (IZhO19_stones) | C++17 | 26 ms | 1900 KB |
#include <bits/stdc++.h> using namespace std; /// 123 int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int sw = 0; if (n < m) swap(n, m), sw = 1; vector<vector<char>> a(n, vector<char>(m, '+')); vector<int> cnt(n, m); int cur = 0; int k = n + 1 >> 1; int res = n; for (int i = 0; i < m; i++) { int ok = 1; for (int j = 0; j < k; j++) { if (cnt[cur] - 1 > m - cnt[cur] + 1) { cnt[cur]--; a[cur][i] = '-'; } else { ok = 0; break; } cur++; cur %= n; } res += ok; } cout << res << '\n'; for (int i = 0; i < (sw ? m : n); i++) { for (int j = 0; j < (sw ? n : m); j++) { cout << (char)(sw ? '-' ^ '+' ^ a[j][i] : a[i][j]); } cout << '\n'; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | in the table A+B is not equal to 6 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | in the table A+B is not equal to 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | in the table A+B is not equal to 6 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 1280 KB | Output is correct |
2 | Correct | 20 ms | 1672 KB | Output is correct |
3 | Correct | 17 ms | 1900 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 1280 KB | in the table A+B is not equal to 46 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | in the table A+B is not equal to 6 |
3 | Halted | 0 ms | 0 KB | - |