猜杯子游戏AI (CI翻译)
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so that on the whole he makes exactly 3 shuffles. After that the spectators have exactly one attempt to guess in which cup they think the ball is and if the answer is correct they get a prize. Maybe you can try to find the ball too?
今天,「Z」市的居民正在参加一场猜杯子游戏比赛。居民们聚集在主广场,观看精彩的表演。表演者将 3 个不透明的杯子倒扣成一排,然后当众把一颗小球放到其中一个杯子下面,接着迅速交换杯子的位置,总共恰好交换 3 次。之后,观众只有一次猜测机会,猜球在哪个杯子下面;如果猜对,就能获得奖品。你也来试着找出小球的位置吧?AI (CI翻译)
Input
输入格式
AI (CI翻译)The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered from left to right and are renumbered after each shuffle from left to right again. In other words, the cup on the left always has index 1, the one in the middle — index 2 and the one on the right — index 3.
第一行包含一个 1 到 3 之间的整数,表示交换杯子之前盖着小球的杯子的编号。接下来的三行描述交换操作。每行包含两个互不相同的 1 到 3 之间的整数,表示表演者这次交换的两个杯子的编号。杯子的编号从左到右排列;每次交换后,都会重新按从左到右的顺序编号。也就是说,左边的杯子编号始终为 1,中间的为 2,右边的为 3。AI (CI翻译)
Output
输出格式
AI (CI翻译)In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles.
第一行输出一个 1 到 3 之间的整数,表示所有交换操作完成后盖着小球的杯子的编号。AI (CI翻译)
样例
1
1 2
2 1
2 1
2
1
2 1
3 1
1 3
2
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。