fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. const int Mod=998244353;
  5.  
  6.  
  7. void solve() {
  8. int n,k;
  9. ll d;
  10. cin >> n >> k >> d;
  11. if(d<k || (n-1)*k<d) {cout << "NO\n"; return;}
  12. cout << "YES\n";
  13. vector<int> ans(k,1);
  14. d-=k;
  15. for(int i=0;i<k;i++){
  16. ll v=min(d,(ll)n-2);
  17. ans[i]+=v;
  18. d-=v;
  19. }
  20. int curr=1;
  21. for(int i=0;i<k;i++){
  22. if((i+1)%2==1){
  23. curr+=ans[i];
  24. }
  25. else
  26. curr-=ans[i];
  27. cout << curr << " ";
  28. }
  29. }
  30.  
  31. int main() {
  32. ios::sync_with_stdio(false);
  33. cin.tie(nullptr);
  34.  
  35. /*int t;
  36.   cin >> t;
  37.   while (t--)*/ solve();
  38.  
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0.01s 5280KB
stdin
10 9 45
stdout
YES
10 1 10 1 6 5 6 5 6