This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//ll check(ll n , ll m , ll k)
//{
// if()
//}
int main()
{
d3
ll t;
cin >> t;
while(t--)
{
ll n , m , k;
cin >> n >> m >> k;
if(n%2||m%2)
{
no;
continue;
}
if(n==2)
{
if(k==m/2)
{
yes;
for(int i = 0 ; n>i ; i++)
{
for(int j = 0 ; m>j ; j++)
{
cout << j/2 +1 << " ";
}
cout << "\n";
}
}
else
no;
}
else if(n==4)
{
if(k-1==m/2-1)
{
yes;
for(int i = 0 ; n>i ; i++)
{
for(int j = 0 ; m>j ; j++)
{
if(i==0||j==0||i==n-1||j==m-1)
cout << 1 << " ";
else
cout << (j-1)/2 +2 << " ";
}
cout << "\n";
}
}
else if(k==m)
{
yes;
for(int i = 0 ; 2>i ; i++)
{
for(int j = 0 ; m>j ; j++)
{
cout << j/2 +1 << " ";
}
cout << "\n";
}
for(int i = 0 ; 2>i ; i++)
{
for(int j = 0 ; m>j ; j++)
{
cout << j/2 +1 +m/2 << " ";
}
cout << "\n";
}
}
else
no;
}
else if(n==6)
{
}
else
no;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |