using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int itemCont = int.Parse(Reader.ReadLine()); string[] inpt = Reader.ReadLine().Split(' '); Dictionary dic = new Dictionary(); Dictionary endDic = new Dictionary(); Dictionary numList = new Dictionary(); for(int i=0; ia.Key >= dic[key] && a.Key <= endDic[key] && a.Value < key).ToList().ForEach(b=>numList[b.Key] = key); } long[] ans = numList.Select(a=>a.Value).ToArray(); Console.WriteLine(string.Join(" " , ans)); } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 6 1 3 10 1 10 2 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }