#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define x first
#define y second
map<string, int> cnt1;
vector<int> cnt[100010];
int re[110];
int main() {
int n, m;
scanf("%d%d", &n,&m);
for (int i = 1; i <=n; i++)
{
int k;
scanf("%d", &k);
for (int j = 0; j < k; j++)
{
int x;
scanf("%d", &x);
cnt[i].push_back(x);
}
}
int p = 1;
for (int i = 0; i < m; i++)
{
int a, b;
scanf("%d%d", &a, &b);
if (a == 0)
{
p = cnt[p][b - 1];
}
else if (a == 1)
{
re[b] = p;
cout << p;
cout << endl;
}
else
{
p = re[b];
}
}
cout<<p;
}
清点代码库
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define x first
#define y se
哲哲打游戏#include<bits/stdc++.h>#include<iostream>using namespace std;#define x first#define y secondmap<string, int> cnt1;vector<int> cnt[100010];int re[110];int main() { int n, m; scanf("%d%d", &n,&m); for (int i =