# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
736999 | 2023-05-06T12:22:23 Z | mjhmjh1104 | Gardening (RMI21_gardening) | C++17 | 23 ms | 620 KB |
#include <cstdio> #include <vector> using namespace std; int t, n, m; long long s; vector<vector<int>> v; void print() { puts("YES"); for (auto &i: v) { for (auto &j: i) printf("%d ", j + 1); puts(""); } } int main() { for (scanf("%d", &t); t--; ) { scanf("%d%d%lld", &n, &m, &s); if (n % 2 || m % 2 || s > 200000) { puts("NO"); continue; } if (n == 2) { if (s != m / 2) { puts("NO"); continue; } v.clear(); v.resize(n); for (int i = 0; i < n; i++) v[i].resize(m); for (int i = 0; i < m / 2; i++) v[0][i * 2] = v[0][i * 2 + 1] = v[1][i * 2] = v[1][i * 2 + 1] = i; print(); continue; } if (n == 4) { int a = m - s; int b = s - m / 2; if (a < 0 || b < 0 || a == 1) { puts("NO"); continue; } v.clear(); v.resize(n); for (int i = 0; i < n; i++) v[i].resize(m); if (a) { v[0][0] = v[1][0] = v[2][0] = v[3][0] = 0; v[0][2 * a - 1] = v[1][2 * a - 1] = v[2][2 * a - 1] = v[3][2 * a - 1] = 0; for (int i = 0; i < a - 1; i++) { v[0][i * 2 + 1] = v[0][i * 2 + 2] = v[3][i * 2 + 1] = v[3][i * 2 + 2] = 0; v[1][i * 2 + 1] = v[1][i * 2 + 2] = v[2][i * 2 + 1] = v[2][i * 2 + 2] = i + 1; } } for (int i = 0; i < b; i++) { v[0][a * 2 + i * 2] = v[0][a * 2 + i * 2 + 1] = v[1][a * 2 + i * 2] = v[1][a * 2 + i * 2 + 1] = a + i * 2; v[2][a * 2 + i * 2] = v[2][a * 2 + i * 2 + 1] = v[3][a * 2 + i * 2] = v[3][a * 2 + i * 2 + 1] = a + i * 2 + 1; } print(); continue; } puts("NO"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 620 KB | Correct! Azusa and Laika like the garden :) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 620 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 11 ms | 468 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 12 ms | 596 KB | Correct! Azusa and Laika like the garden :) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 620 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 11 ms | 468 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 12 ms | 596 KB | Correct! Azusa and Laika like the garden :) |
4 | Failed | 8 ms | 468 KB | Incorrect output |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 1 ms | 212 KB | Incorrect output |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 1 ms | 212 KB | Incorrect output |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 620 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 11 ms | 468 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 12 ms | 596 KB | Correct! Azusa and Laika like the garden :) |
4 | Failed | 8 ms | 468 KB | Incorrect output |
5 | Halted | 0 ms | 0 KB | - |