2021团体程序设计天梯赛 L2-4 哲哲打游戏

思路:

水题,略过

Tip:

#include <bits/stdc++.h>

using namespace std;

const int maxn = 100000 + 5;
vector<int> v[maxn];
int cun[maxn];

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int t;
        cin >> t;
        for (int j = 1; j <= t; j++) {
            int p;
            cin >> p;
            v[i].push_back(p);
        }
    }
    int now = 1;
    while (m--) {
        int nop, j;
        cin >> nop >> j;
        if (nop == 0)
            now = v[now][j - 1];
        else if (nop == 1) {
            cun[j] = now;
            cout << now << endl;
        } else if (nop == 2)
            now = cun[j];
    }
    cout << now << endl;
    return 0;
}

  

上一篇:CF 1110 D. Jongmah


下一篇:cf 1110 D