fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. vector<int> v;
  7. int n = 5, m = 3;
  8. v.resize(n + m);
  9. fill(v.begin(), v.begin() + n, 1);
  10. fill(v.begin() + n, v.end(), 2);
  11. for (int i = 0; i < n + m; ++i) {
  12. cout << v[i] << " ";
  13. }
  14. cout << '\n';
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
1 1 1 1 1 2 2 2