#include <bits/stdc++.h>
#define int long long
#define ll unsigned long long
#define pb push_back
#define p_q priority_queue
#define m_p make_pair
#define pii pair<int,int>
#define endl '\n'
#define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(),x.end()
#define ft first
#define sd second
#define p(x) cout << x << endl;
using namespace std;
const int N = 1e5+5;
const int inf = 1e9;
const int INF = 1e18;
const int MOD = 1e9+7;
bool f(int n, int m, int k) {
if(k*4>n*m) return 0;
if(n%2!=0||m%2!=0) return 0;
if(n==2) {
if(k==m/2) { // squares
p("YES");
forn1(i,k) {
cout << i << ' ' << i << ' ';
}
cout << endl;
forn1(i,k) {
cout << i << ' ' << i << ' ';
}
cout << endl;
return 1;
} else return 0;
} else {
if(m==k) { // squares
p("YES");
forn1(i,m/2) {
cout << i << ' ' << i << ' ';
}
cout << endl;
forn1(i,m/2) {
cout << i << ' ' << i << ' ';
}
cout << endl;
forn1(i,m/2) {
cout << i+m/2 << ' ' << i+m/2 << ' ';
}
cout << endl;
forn1(i,m/2) {
cout << i+m/2 << ' ' << i+m/2 << ' ';
}
cout << endl;
return 1;
} else if (m>=4) {
int b = 2*k-m;
int a = 2*m-2*k;
//cout << a << ' ' << b << endl;
if(a>=4 && b>=0) { // border (x)
p("YES");
forn(i,a) cout << 1 << ' ';
forn1(i,b/2) {
cout << i+a/2 << ' ' << i+a/2 << ' ';
}
cout << endl;
///
cout << 1 << ' ';
forn1(i,a/2-1) cout << i+1 << ' ' << i+1 << ' ';
cout << 1 << ' ';
forn1(i,b/2) {
cout << i+a/2 << ' ' << i+a/2 << ' ';
}
cout << endl;
///
cout << 1 << ' ';
forn1(i,a/2-1) cout << i+1 << ' ' << i+1 << ' ';
cout << 1 << ' ';
forn1(i,b/2) {
cout << i+a/2+b/2 << ' ' << i+a/2+b/2 << ' ';
}
cout << endl;
///
forn(i,a) cout << 1 << ' ';
forn1(i,b/2) {
cout << i+a/2+b/2 << ' ' << i+a/2+b/2 << ' ';
}
cout << endl;
return 1;
} else {
return 0;
}
} else {
return 0;
}
}
}
signed main() {
//INIT
int T;
cin >> T;
while(T--) {
int n, m, k;
cin >> n >> m >> k;
if(!f(n,m,k)) cout << "NO" << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
716 KB |
Correct! Azusa and Laika like the garden :) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
716 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
14 ms |
468 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
14 ms |
600 KB |
Correct! Azusa and Laika like the garden :) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
716 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
14 ms |
468 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
14 ms |
600 KB |
Correct! Azusa and Laika like the garden :) |
4 |
Incorrect |
11 ms |
488 KB |
Expected integer, but "YES" found |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
1 ms |
212 KB |
Incorrect output |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
2 ms |
212 KB |
Incorrect output |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
716 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
14 ms |
468 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
14 ms |
600 KB |
Correct! Azusa and Laika like the garden :) |
4 |
Incorrect |
11 ms |
488 KB |
Expected integer, but "YES" found |
5 |
Halted |
0 ms |
0 KB |
- |