#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
ll n,m,k;
cin>>n>>m>>k;
if(k > floor(n/2) * floor(m/2))
{
cout<<"NO"<<endl;
return ;
}
cout<<"YES"<<endl;
ll x = 0,y = 0,s = 0;
for(ll i = 0;i < n;i++)
{
for(ll j = 0;j < m-1;j+=2)
{
if(y != k)y++;
cout<<y<<" "<<y<<" ";
}
if(m % 2 == 1)cout<<y;
cout<<endl;
if(s == 0)
{
s++;
y = x;
}
else
{
s = 0;
if(y == k)y = x;
else x = y;
}
}
return ;
}
int main()
{
ll t;
cin>>t;
while(t--)solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
123 ms |
844 KB |
Output contains flowers without two equal neighbours |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
123 ms |
844 KB |
Output contains flowers without two equal neighbours |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
123 ms |
844 KB |
Output contains flowers without two equal neighbours |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
16 ms |
692 KB |
Output contains flowers without two equal neighbours |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
6 ms |
340 KB |
Output contains flowers without two equal neighbours |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
123 ms |
844 KB |
Output contains flowers without two equal neighbours |
2 |
Halted |
0 ms |
0 KB |
- |