From cf710ebc13e61acf839141b1b6f4711e4fe4fb1e Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Fri, 1 Oct 2021 18:13:02 +0800 Subject: [PATCH] =?UTF-8?q?52021.=20=E3=80=90LGR-093=E3=80=91=E6=B4=9B?= =?UTF-8?q?=E8=B0=B7=2010=20=E6=9C=88=E6=9C=88=E8=B5=9B=20I=20&=20MCOI=20R?= =?UTF-8?q?6=20(Div.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit T173727: R58860474 --- Luogu/contest/52021/T173727/T173727.cpp | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Luogu/contest/52021/T173727/T173727.cpp diff --git a/Luogu/contest/52021/T173727/T173727.cpp b/Luogu/contest/52021/T173727/T173727.cpp new file mode 100644 index 00000000..4e92b40d --- /dev/null +++ b/Luogu/contest/52021/T173727/T173727.cpp @@ -0,0 +1,44 @@ +#include + +using namespace std; + +int t, n, m, k, c, l; +vector ans; + +int main() { + cin >> t; + while (t--) { + c = 1; + cin >> n >> m >> k; + if (n * m % k != 0) { + cout << "NO" << endl; + } else { + cout << "YES" << endl; + for (int i = 1; i <= n; i++) { + ans.clear(); + if (i & 1) { + for (int j = 1; j <= m; j++) { + if (!--c) { + l++; + c = k; + } + ans.push_back(l); + } + } else { + for (int j = m; j >= 1; j--) { + if (!--c) { + l++; + c = k; + } + ans.insert(ans.begin(), l); + } + } + for (auto i : ans) { + cout << i << ' '; + } + cout << endl; + } + } + } + return 0; +}