{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Alice and Bob have a set of N cards labelled with numbers 1 ... N (so that no two cards have the same label) and a shuffle machine. We assume that N is an odd integer. \n \u003cbr\u003eThe shuffle machine accepts the set of cards arranged in an arbitrary order and performs the following operation of double shuffle : for all positions i, 1 \u0026lt;\u003d i \u0026lt;\u003d N, if the card at the position i is j and the card at the position j is k, then after the completion of the operation of double shuffle, position i will hold the card k. \n \u003cbr\u003e \n \u003cbr\u003eAlice and Bob play a game. Alice first writes down all the numbers from 1 to N in some random order: a1, a2, ..., aN. Then she arranges the cards so that the position ai holds the card numbered a\n \u003csub\u003ei+1\u003c/sub\u003e, for every 1 \u0026lt;\u003d i \u0026lt;\u003d N-1, while the position aN holds the card numbered a1. \n \u003cbr\u003e \n \u003cbr\u003eThis way, cards are put in some order x1, x2, ..., xN, where xi is the card at the i\n \u003csup\u003eth\u003c/sup\u003e position. \n \u003cbr\u003e \n \u003cbr\u003eNow she sequentially performs S double shuffles using the shuffle machine described above. After that, the cards are arranged in some final order p1, p2, ..., pN which Alice reveals to Bob, together with the number S. Bob\u0027s task is to guess the order x1, x2, ..., xN in which Alice originally put the cards just before giving them to the shuffle machine. \n \u003cbr\u003e\u003cbr\u003e\n题目大意:\n\n第i个位置的牌是a[i],一次交换后第i个位置的牌变成a[a[i]]。序列所有位置经过一次交换为一次交换,已知交换m次之后的序列,求原先序列,保证 N 是奇数\u003cbr\u003e\n比如: 4 7 5 6 1 2 3\u003cbr\u003e\n\n进行一次变换 :6 3 1 2 4 7 5\u003cbr\u003e\n\n而不能直接将原来第i个位置的牌改变,不能变成 6 3 1 2 6 3 5\u003cbr\u003e\n\n意思就是说新的序列式在原有序列的基础上,在交换的过程中没有改变原有序列的值,从而得到一个\n\n新的序列。\u003cbr\u003e\n \u003c/div\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The first line of the input contains two integers separated by a single blank character : the odd integer N, 1 \u0026lt;\u003d N \u0026lt;\u003d 1000, the number of cards, and the integer S, 1 \u0026lt;\u003d S \u0026lt;\u003d 1000, the number of double shuffle operations. \n \u003cbr\u003eThe following N lines describe the final order of cards after all the double shuffles have been performed such that for each i, 1 \u0026lt;\u003d i \u0026lt;\u003d N, the (i+1)\n \u003csup\u003est\u003c/sup\u003e line of the input file contains pi (the card at the position i after all double shuffles). \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The output should contain N lines which describe the order of cards just before they were given to the shuffle machine. \n \u003cbr\u003eFor each i, 1 \u0026lt;\u003d i \u0026lt;\u003d N, the ith line of the output file should contain xi (the card at the position i before the double shuffles). \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e7 4\n6\n3\n1\n2\n4\n7\n5\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n7\n5\n6\n1\n2\n3\u003c/pre\u003e"}}]}