mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 20:16:29 +00:00
52021. 【LGR-093】洛谷 10 月月赛 I & MCOI R6 (Div.2)
T173727: R58860474
This commit is contained in:
parent
e9464143da
commit
cf710ebc13
44
Luogu/contest/52021/T173727/T173727.cpp
Normal file
44
Luogu/contest/52021/T173727/T173727.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int t, n, m, k, c, l;
|
||||
vector<int> 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user