private void MultiSetRemoveAt()
 {
     for (int i = 0; i < count; i++)
     {
         multiSet.RemoveAt(multiSet.Count - 1);
     }
 }
Esempio n. 2
0
    static object Solve()
    {
        var(n, k) = Read2();
        var s = Console.ReadLine();

        var r = new List <char>();

        var comp = Comparer2 <int> .Create(i => s[i], i => i);

        var set = new IndexedMultiSet <int>(comp);

        for (int i = 0; i < n - k; i++)
        {
            set.Add(i);
        }

        var t = -1;

        for (int i = n - k; i < n; i++)
        {
            set.Add(i);
            while (set.GetFirst() < t)
            {
                set.RemoveAt(0);
            }

            t = set.RemoveAt(0);
            r.Add(s[t]);
        }

        return(string.Join("", r));
    }
        public void RemoveAt()
        {
            set.RemoveAt(0);
            Assert.AreEqual(6, set.Count);
            AssertItemsOrder();

            set.Add(10);
            set.RemoveAt(2);
            Assert.AreEqual(6, set.Count);
            AssertItemsOrder();

            set.Insert(0, -1);
            set.Add(-1);
            set.RemoveAt(0);
            Assert.AreEqual(7, set.Count);
            Assert.IsTrue(set.Contains(-1));
            AssertItemsOrder();

            set.RemoveAt(0);
            Assert.AreEqual(6, set.Count);
            Assert.IsFalse(set.Contains(-1));
            AssertItemsOrder();
        }