using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int numCount = int.Parse(Reader.ReadLine()); List numList = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToList(); bool ans = this.GetAns(numList, true); if(ans) { Console.WriteLine(string.Join(" ", lastMatched)); } else { Console.WriteLine("-1"); } } private Dictionary winDic = new Dictionary(); int[] lastMatched = new int[3]; private bool GetAns(List target, bool isFirst) { string key = string.Join("#", target); if(winDic.ContainsKey(key)) { return winDic[key]; } if(target.Count <= 0) { return false; } bool ans = false; for(int i=0; i target[j] && target[j] > target[k]) { continue; } if(target[i] == target[j] || target[j] == target[k] || target[i] == target[k]) { continue; } List subList = new List(target); subList.RemoveAt(k); subList.RemoveAt(j); subList.RemoveAt(i); if(!this.GetAns(subList, false)) { ans = true; mustBreak = true; if(isFirst) { this.lastMatched = new int[] {i, j, k}; } break; } } if(mustBreak) { break; } } if(mustBreak) { break; } } winDic.Add(key, ans); return ans; } private void BaseSetup(List target) { for(int i=0; i