fork download
  1. #include <stdio.h>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5. int getRegIndex(int num,vector<int> &reg){
  6. reg.resize(reg.size()+1);
  7. return reg.size()-1;
  8. }
  9. int main() {
  10. vector<int> reg;
  11. for(int i=0;i<10;++i){
  12. if(reg.size()+2>reg.capacity()){
  13. reg.push_back(0);
  14. reg.push_back(0);
  15. reg.pop_back();
  16. reg.pop_back();
  17. }
  18. reg[getRegIndex(1,reg)]=getRegIndex(2,reg);
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 3268KB
stdin
Standard input is empty
stdout
Standard output is empty