Example #1
0
        static void Main()
        {
            var n    = ReadInt();
            var k    = ReadLong();
            var dict = new SortedMultiSet <int>();

            n.Times(() => new { a = ReadInt(), b = ReadInt() }).ForEach(x => dict[x.a] += x.b);

            foreach (var key in dict.Keys)
            {
                k -= dict[key];
                if (k <= 0)
                {
                    key.WriteLine();
                    return;
                }
            }
        }
Example #2
0
        static void Main()
        {
            var n    = ReadInt();
            var k    = ReadLong();
            var dict = new SortedMultiSet <int>();

            for (int i = 0; i < n; i++)
            {
                var a = ReadInt();
                var b = ReadInt();
                dict[a] += b;
            }

            foreach (var key in dict.Keys)
            {
                k -= dict[key];
                if (k <= 0)
                {
                    key.WriteLine();
                    return;
                }
            }
        }
Example #3
0
 public SortedMultiSet(SortedMultiSet <T> source) : this(source.occurrence)
 {
 }