oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

bigarray Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

statement.html

Problem Description

There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), bi copies of an integer ai are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array {1,2,2,3,3,3} is 3.

Input

The first line of the input will contain 2 integers, N and K.

Then N lines with 2 integers will follow, the i-th line will contain 2 integers, ai and bi.

Output

Print the K-th smallest integer in the array after the N operations.

Limits

  • 1≤N≤105
  • 1≤ai,bi≤105
  • 1≤K≤b1…+…bn
  • All input values are integers.

Subtask 1 (31%): bi = 1.

Subtask 2 (69%): No additional constraints.

Subtask 3 (0%): Sample test cases.

Sample Input 1

3 4
1 1
2 2
3 3

Sample Output 1

3

Sample Input 2

10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Sample Output 2

1

 

Tags

AtCoder, Sorting

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
13171s256MBMinimum
269171s256MBMinimum
3021s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o bigarray -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.