当前位置:网站首页>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
边栏推荐
- 批量下载文件----压缩后再下载
- A set of combination boxing to create an idea eye protection scheme
- 2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)
- Mysql database design specification
- POI create and export Excel based on data
- Student achievement management
- Using jsonserialize to realize data type conversion gracefully
- Data mining series (3)_ Data mining plug-in for Excel_ Estimation analysis
- ThreadLocal 测试多线程变量实例
- Flink customizes the application of sink side sinkfunction
猜你喜欢

IOTOS物联中台对接海康安防平台(iSecure Center)门禁系统

Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions

AWS from entry to actual combat: creating accounts

《C语言程序设计》(谭浩强第五版) 第9章 用户自己建立数据类型 习题解析与答案

JS inheritance

Data mining series (3)_ Data mining plug-in for Excel_ Estimation analysis

Supersocket is Use in net5 - startup

Student achievement management

Unity basics 2

2022t elevator repair test simulation 100 questions and online simulation test
随机推荐
Supersocket is Use in net5 - concept
Batch download of files ---- compressed and then downloaded
C abstract class
Eight elder brothers chronicle [4]
IDEA查看历史记录【文件历史和项目历史】
js 中,为一个里面带有input 的label 绑定事件后在父元素绑定单机事件,事件执行两次,求解
一文了解全面静态代码分析
Comprehensive calculation of employee information
Huawei mobile ADB devices connection device is empty
Xutils3 corrected a bug I reported. Happy
EasyUI's combobox implements three-level query
Supersocket is Used in net5 - command
Idea view history [file history and project history]
There is no index in the database table. When inserting data, SQL statements are used to prevent repeated addition (Reprint)
Unity Basics
Generate QR code through zxing
Configuration table and page information automatically generate curd operation page
《C语言程序设计》(谭浩强第五版) 第8章 善于利用指针 习题解析与答案
A comprehensive understanding of static code analysis
2022 团体程序设计天梯赛 模拟赛 L2-1 盲盒包装流水线 (25 分)