D.cpp 355 B

12345678910111213141516171819202122232425
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. vector<int> a;
  5. int q;
  6. cin >> q;
  7. while (q--) {
  8. int op;
  9. cin >> op;
  10. if (op == 0) {
  11. int x;
  12. cin >> x;
  13. a.push_back(x);
  14. } else if (op == 1) {
  15. int p;
  16. cin >> p;
  17. cout << a[p] << endl;
  18. } else {
  19. a.pop_back();
  20. }
  21. }
  22. return 0;
  23. }