You are viewing a single comment's thread. Return to all comments →
c# code {int bribe=0; List l =new List();
l.AddRange(q); l.Sort(); int index=0,lindex=0; while(index<q.Count){ if(q[index]!=l[lindex]){ int e=l.IndexOf(q[index]); e-=lindex; if(e>=3) { Console.WriteLine("Too chaotic"); return; } else { bribe+=e; l.RemoveAt(e+lindex); } }else { lindex++; } index++; } Console.WriteLine(bribe); }
New Year Chaos
You are viewing a single comment's thread. Return to all comments →
c# code {int bribe=0; List l =new List();