제출 #593504

#제출 시각아이디문제언어결과실행 시간메모리
593504pakhomoveeGardening (RMI21_gardening)C++17
0 / 100
61 ms760 KiB
#include <iostream> #include <vector> #include <algorithm> #include <random> #include <iomanip> #include <cassert> #include <deque> #include <functional> #include <set> #include <queue> #include <unordered_map> #include <map> #include <iomanip> #include <complex> using namespace std; int gcd(int a, int b) { if (!b) { return a; } return gcd(b, a % b); } int32_t main() { int t; cin >> t; while (t--) { int n, m, k; cin >> n >> m >> k; if (n % 2 == 1 || m % 2 == 1) { cout << "NO" << '\n'; } else { bool ok = false; for (int borderSize = 0; borderSize < min(n, m) / 2; ++borderSize) { if (borderSize + (n - 2 * borderSize) * (m - 2 * borderSize) / 4 == k) { vector<vector<int>> matr(n, vector<int> (m, 0)); for (int i = 0; i < borderSize; ++i) { for (int j = i; j < m - i; ++j) { matr[i][j] = i + 1; matr[n - i - 1][j] = i + 1; } for (int j = i; j < n - i; ++j) { matr[j][i] = i + 1; matr[j][m - i - 1] = i + 1; } } int c = borderSize; for (int x = borderSize; x < n - borderSize; x += 2) { for (int y = borderSize; y < m - borderSize; y += 2) { matr[x][y] = matr[x + 1][y] = matr[x][y + 1] = matr[x + 1][y + 1] = ++c; } } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cout << matr[i][j] << ' '; } cout << '\n'; } ok = true; break; } } if (!ok) { cout << "NO\n"; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...