fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int a[100], b[100];
  4. void pr(int a[], int b[], int n){
  5. cout << "YES" << endl;
  6. for(int i = 1; i <= n; i++) cout << a[i] << " ";
  7. cout << endl;
  8. for(int i = 1; i <= n; i++) cout << b[i] << " ";
  9. cout << endl;
  10. }
  11. int main() {
  12. int t, n, x, y; cin >> t;
  13. while(t--){
  14. cin >> n >> x >> y;
  15. if(x + y > n || x + y == 1 || (x + y > 0) && (x == 0 || y == 0)){
  16. cout << "NO" << endl;
  17. continue;
  18. }
  19.  
  20. int df = x;
  21. for(int i = 1; i + df <= (x + y); i++){
  22. a[i] = i;
  23. b[i] = i + df;
  24. }
  25. for(int i = (x + y) - df + 1; i <= (x + y); i++){
  26. a[i] = i;
  27. b[i] = i - (x + y) + df;
  28. }
  29. for(int i = x + y + 1; i <= n; i++){
  30. a[i] = i;
  31. b[i] = i;
  32. }
  33. pr(a, b, n);
  34.  
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0s 5316KB
stdin
1
5 3 2
stdout
YES
1 2 3 4 5 
4 5 1 2 3