fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const int MAX_SIZE = 1300000;
  6. int numb_n, numb_m, counter = 0, v[MAX_SIZE + 2];
  7. cin >> numb_n >> numb_m;
  8. for (int i = 1; i <= numb_n; ++i) {
  9. cin >> v[i];
  10. ++counter;
  11. }
  12. int k_operation, numb_x, j = 1;
  13. for (int m_operations = 1; m_operations <= numb_m; ++m_operations) {
  14. cin >> k_operation;
  15. if (k_operation == 1) {
  16. ++j;
  17. }
  18. if (k_operation == 2) {
  19. cin >> numb_x;
  20. v[++numb_n] = numb_x;
  21. }
  22. }
  23. if (numb_n - j < 0) {
  24. cout << 0 << "\n";
  25. } else {
  26. cout << numb_n - j + 1 << "\n";
  27. }
  28. for (int i = j; i <= numb_n; ++i) {
  29. cout << v[i] << " ";
  30. }
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.01s 5456KB
stdin
4 6
30 21 81 26
1
1
1
1
1
1
stdout
0