using System; using System.Linq; using System.Collections.Generic; public class Program { public void Proc() { Reader.IsDebug = false; int[] inpt = Reader.ReadLine().Trim().Split(' ').Select(a=>int.Parse(a)).ToArray(); int cupCount = inpt[0]; int swapCount = inpt[1]; int target = inpt[2] - 1; int[] tyokuzen = new int[cupCount]; for(int i=0; iint.Parse(a)-1).ToArray(); this.Swap(tyokuzen, inpt[0], inpt[1]); } Reader.ReadLine(); List swList = new List(); for(int i=target+1; iint.Parse(a)-1).ToArray()); } string[] inptstr = Reader.ReadLine().Trim().Split(' '); int[] tyokugo = new int[inptstr.Length]; for(int i=0;i=0;i--) { Swap(tyokugo, swList[i][0], swList[i][1]); } List ans = new List(); for(int i=0; i= 2) { break; } } } Console.WriteLine(string.Join(" ", ans)); } private void Swap(int[] arr, int idx1, int idx2) { int num = arr[idx1]; arr[idx1] = arr[idx2]; arr[idx2] = num; } public class Reader { public static bool IsDebug = true; private static System.IO.StringReader SReader; private static string InitText = @" "; public static string ReadLine() { if(IsDebug) { if(SReader == null) { SReader = new System.IO.StringReader(InitText.Trim()); } return SReader.ReadLine(); } else { return Console.ReadLine(); } } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }