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; } } }
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; } } }
public SortedMultiSet(SortedMultiSet <T> source) : this(source.occurrence) { }