CT22150

The Peculiar weights of Steward

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the bamboo terraces of Verdantstep; Steward weighs the day's weights manifests and starts the calculations. Task: Print the k-th largest element (1-based; duplicates count separately). Input format: First line: n and k. Second line: n integers. Output format: Print the k-th largest value. Constraints: 1 <= k <= n <= 553; -1000000000 <= a[i] <= 1000000.

Example 1:

Input: 298 157 -186871917 -842040689 -301150256 -574092364 -550369125 -37096286 -475554211 -154021833 -196145728 -974248565 -812601434 -663258321 -921733360 -580579448 -397751496 -155512970 -222321336 -718079852 -631748439 -402819405 -90217717 -484424065 -981366171 -32376755 -360600127 -186699356 -870328322 -700987943 -421139938 -121221315 -286759633 -592003387 -328249314 -957723668 -191380787 -756534216 -784778874 -449906488 -734806360 -71308364 -328464843 -652147074 -462491079 -910641050 -224850955 -824998658 -269878874 -186775596 -754716325 -486955901 -597545937 -689335805 -65115390 -63850304 -300827084 -201111941 -658161403 -198487490 -954061072 -136842102 -144690697 -274622804 -804960405 -345037562 -65699532 -147890528 -643959947 -668794258 -680509451 -667831579 -697036641 -774046091 -855228…
Output: -574092364

Example 2:

Input: 422 401 -511736448 -980665607 -316126489 -881150298 -201560928 -415495941 -407239388 -473107777 -188269467 -931341027 -356033584 -601683190 -216091971 -602693424 -62335533 -903069118 -281249942 -6103465 -620414235 -823232530 -287555832 -886351974 -337695541 -705861337 -411064657 -664075059 -294852815 -694703051 -902373307 -222939644 -61033983 -704093122 -232893717 -629348164 -571219383 -16195005 -589672757 -988573384 -348837500 -245086717 -174486814 -592085285 -989093249 -989846223 -327561485 -268083752 -349209793 -347781728 -839305472 -324388062 -656329821 -538706953 -424055244 -836331424 -568877431 -11458198 -635170153 -702775285 -100349676 -523742601 -287181185 -900611435 -404352967 -151756176 -667947203 -463257868 -292216491 -736215573 -98506028 -645562224 -579492987 -644990209 -492869…
Output: -958384188

Example 3:

Input: 117 75 -682961474 -625360872 -584938375 -81159925 -59614812 -678339595 -763664398 -855610481 -160456340 -404264423 -513672294 -836665470 -702959223 -4237960 -78675466 -551213368 -66720119 -669500766 -798785290 -494025410 -272495944 -635949098 -973683339 -477622227 -409495699 -562228928 -321293609 -46950410 -727838729 -191309605 -829511032 -404327481 -792806518 -193430200 -456830027 -901795141 -877161798 -878254105 -393280350 -19040288 -25586737 -305213532 -56569131 -270024831 -899570222 -915014365 -43900804 -506278375 -259461537 -613097042 -880161096 -230614258 -804949330 -428589802 -625305384 -716236413 -498553618 -510175510 -615799659 -709937509 -421661650 -906885022 -935163455 -234865867 -67203019 -344936598 -463235781 -671372389 -751985393 -271188270 -596234382 -653352175 -314135276 -2…
Output: -652173080

Constraints:

1 <= k <= n <= 553; -1000000000 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.