Top contestants
Practice
2.1 (9 votes)
Basic programming
Basics of implementation
Easy
Implementation
Java
Python
Quick sort
Sorting
Problem
72% Success 3367 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given that \(N\) candidates participated in a contest. For each candidate, you are given \(A_i\), representing the points scored by the \(i^{th}\) candidate in the contest. You have to print the indexes of the top \(K\) candidates of the contest.

Note: \(A_i \ne A_j \forall i \ne j\) i.e, all \(A_i\)are distinct.


Input format

  • First line: Two space-separated integers \(N\) and \(K\)
  • Next line: \(N\) space-separated integers. The \(i^{th}\)integer denotes the points scored by the \(i^{th}\)candidate in the contest.

Output format

  • Print \(K\) space-separated integers, denoting the indexes of the top \(K\) candidates.

Constraints

\(1 \le N \le 10^{5}\)

\(1 \le K \le N\)

\(1 \le A_i \le 10^{9}\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
58 votes
Tags:
ApprovedEasyImplementationOpen
Points:20
27 votes
Tags:
ArraysEasyImplementationMathRecursion
Points:20
50 votes
Tags:
ApprovedBasic ProgrammingEasyHash MapsOpen