当前位置:网站首页>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
边栏推荐
- 通过 zxing 生成二维码
- Charles uses three ways to modify requests and responses
- Mysql database
- 可以接收多种数据类型参数——可变参数
- Batch download of files ---- compressed and then downloaded
- Mysql database design specification
- Is it difficult to choose binary version control tools? After reading this article, you will find the answer
- Can you answer the questions that cannot be answered with a monthly salary of 10k-20k?
- Generate QR code through zxing
- Problem a: face recognition
猜你喜欢

Supersocket is Used in net5 - command
![[MySQL] left function | right function](/img/26/82e0f2280de011636c26931a74e749.png)
[MySQL] left function | right function

2022t elevator repair test simulation 100 questions and online simulation test

超好用的Excel异步导出功能

Knowledge of software testing~

Web Course Design - his system

研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台

打卡:4.22 C语言篇 -(1)初识C语言 - (11)指针

Peut recevoir plusieurs paramètres de type de données - paramètres variables
![Use of ADB command [1]](/img/e6/fb8fd6956c226f75b831f8eb46277f.png)
Use of ADB command [1]
随机推荐
Ide-idea-problem
Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
《C语言程序设计》(谭浩强第五版) 第8章 善于利用指针 习题解析与答案
Mysql database design specification
JSON related
Top 9 task management system in 2022
可以接收多种数据类型参数——可变参数
JS inheritance
C set
Unity Basics
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
Configure automatic implementation of curd projects
poi根据数据创建导出excel
场景题:A系统如何使用B系统的页面
批量下載文件----壓縮後再下載
Problem B: small challenge
Data mining series (3)_ Data mining plug-in for Excel_ Estimation analysis
. net 5 Web custom middleware implementation returns the default picture
Mysql database
2022 团体程序设计天梯赛 模拟赛 L2-4 哲哲打游戏 (25 分)