#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);
#define lin cout << "\n";
using namespace std;
int main()
{
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==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";
}
continue;
}
for(int idx = 0 ; m>idx ; idx+=2)
{
if(idx==m-2)
{
no;
break;
}
if(k==idx+1+(m-idx-2)/2)
{
yes;
for(int i = 0 ; n>i ; i++)
{
for(int j = 0 ; m>j ; j++)
{
if(j<idx)
{
cout << j/2+1+(i/2)*(idx/2) << " ";
}
else if(i==0||i==3||j==idx||j==m-1)
{
cout << idx+1 << " ";
}
else
{
cout << (j-idx-1)/2+idx+2 << " ";
}
}
lin
}
break;
}
}
}
else if(n==6)
{
}
else
no;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
800 KB |
Correct! Azusa and Laika like the garden :) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
800 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
10 ms |
600 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
11 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
800 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
10 ms |
600 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
11 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
4 |
Incorrect |
9 ms |
604 KB |
Expected integer, but "YES" found |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
1 ms |
348 KB |
Incorrect output |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
1 ms |
348 KB |
Incorrect output |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
800 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
10 ms |
600 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
11 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
4 |
Incorrect |
9 ms |
604 KB |
Expected integer, but "YES" found |
5 |
Halted |
0 ms |
0 KB |
- |