当前位置:网站首页>2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
2022-04-23 03:23:00 【One more line and go to bed】
Zhe Zhe is a hardcore gamer . The latest one is called 《 Dano Dano 》 Our new game has just come out , Zhe zhe naturally wants a quick introduction game , Guard everything for hardcore gamers !
To simplify the model , We might as well assume that the game has N A plot point , Through different operations or choices in the game, you can go from one plot point to another . Besides , The game also has some The archive , At a certain plot point, the player's game progress can be saved in a file , After reading the archive, you can return to the plot point , Operate again or select , Reach different plot points .
In order to track the progress of hard core game player zhe Zhe's strategy , You're going to write a program to do the job . Suppose you already know all the plot points and processes of the game , And zhe Zhe's game operation , Please output zhe Zhe's game progress .
Input format :
The first line of input is two positive integers N and M (1≤N,M≤105), It means that there is a total of N A plot point , Zhe zhe you M Game controls .
Next N That's ok , Each line corresponds to the development setting of a plot point . The first i The first number in the line is Ki, Show plot point i Through some operation or selection, you can go down Ki A plot point ; Next there is Ki A digital , The first k A number means to do the k An operation or select the plot point number that you can go to .
In the end M That's ok , The first number in each line is 0、1 or 2, respectively :
- 0 Indicates that zhe zhe has made an operation or choice , Followed by a number j, It means that zhe zhe has made the... At the current plot point j A choice . We guarantee that zhe Zhe's choice is always legal .
- 1 Indicates that zhe zhe has archived once , Followed by a number j, Indicates that the archive is placed in the j In one gear .
- 2 Indicates that zhe zhe has performed an operation to read the archive , Followed by a number j, Indicates that it has been read and placed in the j Archive in multiple locations .
Appointment : All operations or selections and plot point numbers are from 1 The start . The archived gear does not exceed 100 individual , The number is also from 1 Start . The game defaults from 1 The plot starts at . Total number of options ( namely ∑Ki) No more than 106.
Output format :
For each 1( Namely archiving ) operation , Output the archived plot point number in one line .
The last line outputs the plot point number that zhe zhe finally arrived .
#include <bits/stdc++.h>
using namespace std;
int main(void){
int n,m,k,ki,s,t,cr=1;
cin>>n>>m;
vector<int> p[n+1];
for(int i=1;i<=n;i++){
cin>>k;
while(k--){
cin>>ki;
p[i].push_back(ki);
}
}
map<int,int> ld;
while(m--){
cin>>s>>t;
switch(s){
case 0:{
cr=p[cr][t-1];
break;
}
case 1:{
ld[t]=cr;
cout<<cr<<endl;
break;
}
case 2:{
cr=ld[t];
break;
}
}
}
cout<<cr;
return 0;
}
版权声明
本文为[One more line and go to bed]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230322232761.html
边栏推荐
- 可以接收多种数据类型参数——可变参数
- MySQL之explain关键字详解
- Supersocket is Use in net5 - concept
- Téléchargement en vrac de fichiers - téléchargement après compression
- Ide-idea-problem
- Mysql database
- Scenario Title: how does system a use the page of system B
- socket编程 send()与 recv()函数详解
- Student achievement management
- Knowledge of software testing~
猜你喜欢
General test technology [II] test method
Supersocket is Used in net5 - command
Configure automatic implementation of curd projects
[MySQL] left Function | Right Function
超好用的【通用Excel导入功能】
2022a special equipment related management (elevator) work license question bank and simulation examination
2022 团体程序设计天梯赛 模拟赛 1-8 均是素数 (20 分)
Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
[mock data] fastmock dynamically returns the mock content according to the incoming parameters
Seminar playback video: how to improve Jenkins' ability to become a real Devops platform
随机推荐
Cefsharp stores cookies and reads cookies
超好用的【通用Excel导入功能】
Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)
Experiment 5 components and event handling
2022 团体程序设计天梯赛 模拟赛 1-8 均是素数 (20 分)
C set
2022 团体程序设计天梯赛 模拟赛 L2-1 盲盒包装流水线 (25 分)
Problem a: face recognition
Explanation keyword of MySQL
浅学一下I/O流和File类文件操作
12.<tag-链表和常考点综合>-lt.234-回文链表
全新的ORM框架——BeetlSQL介绍
Visual programming - Experiment 2
JS recursive tree structure calculates the number of leaf nodes of each node and outputs it
Xutils3 corrected a bug I reported. Happy
研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台
Using swagger in. Net5
xutils3修改了我提报的一个bug,开心
Supersocket is Use in net5 - concept