10pts
  • 板块B3631 单向链表
  • 楼主yyjw14
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/9/29 13:00
  • 上次更新2023/11/2 17:21:45
查看原帖
10pts
916380
yyjw14楼主2023/9/29 13:00
#include<bits/stdc++.h>
using namespace std;
int nxt[1000005];

int main()
{
    int i,j,k,x,y,z;
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>i;
    for(j=1;j<=i;j++)
    {
        cin>>x;
        if(x==1)
        {
            cin>>y>>z;
            nxt[y]=z;
        }
        else if(x==2)
        {
            cin>>k;
            cout<<nxt[k]<<'\n';
        }
        else
        {
            cin>>k;
            nxt[k]=nxt[nxt[k]];
        }
    }
    return 0;
}
2023/9/29 13:00
加载中...