# 14041: 【原4041】STL系列-vector

### 题目描述

author: Engineev 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/4041

## Input Format

1. 第\(i\)行和数\(y\)
2. 第\(i\)行
3. 第\(i\)行第\(j\)列

## Sample Input

``````3 10
1 1 1622650073
3 1 0
1 2 1458777923
2 2
1 2 114807987
3 1 0
2 1
1 1 1264817709
3 1 0
1 0 893351816
``````

## Sample Output

``````1622650073
1622650073
735329012
``````

## FineArtz's solution

``````/* STL-vector */
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
using namespace std;

int main(){
int n, m;
scanf("%d%d", &n, &m);
//cin >> n >> m;
vector<vector<int>> v;
int last3 = -1;
v.resize(n);
while (m--){
int t, i, x;
scanf("%d", &t);
switch(t){
case 1:
scanf("%d%d", &i, &x);
//cin >> i >> x;
if (last3 == -1) v[i].push_back(x);
else v[i].push_back(x ^ last3);
break;
case 2:
scanf("%d", &i);
//cin >> i;
v[i].erase(v[i].end() - 1);
break;
case 3:
scanf("%d%d", &i, &x);
//cin >> i >> x;
last3 = v[i][x];
printf("%d\n", v[i][x]);
//cout << v[i][x] << endl;
break;
default:
break;
}
}
return 0;
}
``````