日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Find The Bone

發布時間:2024/10/5 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Find The Bone 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Description
Zane the wizard is going to perform a magic show shuffling the cups.

There are n cups, numbered from 1 to n, placed along the x-axis on a table that has m holes on it. More precisely, cup i is on the table at the position x?=?i.

The problematic bone is initially at the position x?=?1. Zane will confuse the audience by swapping the cups k times, the i-th time of which involves the cups at the positions x?=?ui and x?=?vi. If the bone happens to be at the position where there is a hole at any time, it will fall into the hole onto the ground and will not be affected by future swapping operations.

Do not forget that Zane is a wizard. When he swaps the cups, he does not move them ordinarily. Instead, he teleports the cups (along with the bone, if it is inside) to the intended positions. Therefore, for example, when he swaps the cup at x?=?4 and the one at x?=?6, they will not be at the position x?=?5 at any moment during the operation.

Zane’s puppy, Inzane, is in trouble. Zane is away on his vacation, and Inzane cannot find his beloved bone, as it would be too exhausting to try opening all the cups. Inzane knows that the Codeforces community has successfully helped Zane, so he wants to see if it could help him solve his problem too. Help Inzane determine the final position of the bone.

Input
The first line contains three integers n, m, and k (2?≤?n?≤?106, 1?≤?m?≤?n, 1?≤?k?≤?3·105) — the number of cups, the number of holes on the table, and the number of swapping operations, respectively.

The second line contains m distinct integers h1,?h2,?…,?hm (1?≤?hi?≤?n) — the positions along the x-axis where there is a hole on the table.

Each of the next k lines contains two integers ui and vi (1?≤?ui,?vi?≤?n, ui?≠?vi) — the positions of the cups to be swapped.

Output
Print one integer — the final position along the x-axis of the bone.

Examples
Input
7 3 4
3 4 6
1 2
2 5
5 7
7 1
Output
1
Input
5 1 2
2
1 2
2 4
Output
2
Note
In the first sample, after the operations, the bone becomes at x?=?2, x?=?5, x?=?7, and x?=?1, respectively.

In the second sample, after the first operation, the bone becomes at x?=?2, and falls into the hole onto the ground.

#include <stdio.h> #include <stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */ long n,m,k; long h[1000000]; int main(int argc, char *argv[]) {scanf("%ld%ld%ld",&n,&m,&k);long i,j;long temp;for(i=0;i<m;i++){scanf("%ld",&temp);h[temp]=1;}long temp1,temp2;long qiu=1;int flag=1;if(h[1]){flag=0;}else{for(i=1;i<=k;i++){scanf("%ld%ld",&temp1,&temp2);if((qiu==temp1||qiu==temp2)&&flag)qiu=temp1+temp2-qiu;if(h[qiu]==1)flag=0;}}printf("%ld\n",qiu);return 0; }

總結

以上是生活随笔為你收集整理的Find The Bone的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲第一免费网站 | 久久久久久久影院 | 日韩美女视频一区二区 | 亚洲乱熟女一区二区三区小说 | 白丝久久 | 美女的隐私免费看 | 古装做爰无遮挡三级 | 日韩乱码人妻无码中文字幕久久 | 久色综 | 少妇熟女一区 | 国产一区二区三区免费观看视频 | 日韩有码在线播放 | 黄色调教视频 | 少妇饥渴放荡91麻豆 | 麻豆国产一区二区三区四区 | 日本嫩草影院 | 超碰caoprom | 免费日皮视频 | 性喷潮久久久久久久久 | 91精品人妻一区二区三区果冻 | 无码人妻丰满熟妇区毛片18 | 中文字幕一区二区三区人妻不卡 | 成人精品久久久 | 97精品国产 | 日本性高潮视频 | 欧美精品黄色片 | 男女视频久久 | 嫩草私人影院 | 夜夜狠 | 中文字幕日韩欧美在线 | 亚洲老女人视频 | 精品三级av| 午夜av一区二区三区 | 尼姑福利影院 | 欧美性猛交xxx乱大交3 | 国产日韩欧美电影 | 亚洲情人网 | www污污 | 精品久久精品 | 91丨九色丨海角社区 | 中文字幕日韩在线观看 | 蜜桃在线一区二区 | 国产喷水视频 | 日韩欧美中文字幕精品 | 97超碰色| 国产伦精品一区二区三区 | 日韩www在线观看 | 欧美一区二区三区爽爽爽 | 日本道在线观看 | 手机福利视频 | 伊人色网 | 色无极影院亚洲 | 金鱼妻日剧免费观看完整版全集 | 国产免费av网站 | 中文字幕一区二区在线观看视频 | 6080电视影片在线观看 | 日韩av毛片 | 国产制服91一区二区三区制服 | 天天操天天操天天操天天操天天操 | 日本我不卡 | 欧美激情视频二区 | 国产精品区二区三区日本 | 欧美丝袜脚交 | 午夜亚洲一区 | 在线免费观看国产视频 | www国产视频 | 不许穿内裤随时挨c调教h苏绵 | 日本欧美在线 | 九色福利 | 欧美激情一区二区三区p站 欧美mv日韩mv国产网站app | 成人自拍网| av手机在线观看 | 欧美另类videossexo高潮 | 天天躁日日躁狠狠躁av | 最新激情网站 | 夜夜嗨av禁果av粉嫩avhd | 18国产免费视频 | 日本成人动漫在线观看 | 羽月希奶水一区二区三区 | 国产成人无码AA精品区 | 91天天爽| 久久精品国产av一区二区三区 | 亚洲免费av电影 | 91久久久精品 | 精品国产视频在线 | 黄色网址视频 | 国产aⅴ激情无码久久久无码 | 日本在线一区二区三区 | 老司机深夜免费福利 | 女教师三上悠亚ssni-152 | 亚色一区 | 青青青视频免费 | 黄色福利网站 | 亚洲综合p | 999久久久久 | 欧美日韩综合一区 | www.精品| 麻豆av在线免费观看 | 美女伊人网 |