CT25385

Steward's shelves Reckoning

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Steward the cartographer watches over the shipyard of Keelwind's stores of shelves. A careful computation stands between order and chaos. Task: The array is sorted in non-decreasing order. Print the 1-based index of the first occurrence of x, or -1 if x is absent. Input format: First line: n and x. Second line: n sorted integers. Output format: Print the 1-based index or -1. Constraints: 1 <= n <= 702; -1000000000 <= a[i],x <= 1000000.

Example 1:

Input: 440 -662196010 -999414598 -998553662 -996630812 -995056819 -993157365 -992823214 -991671099 -989252392 -983510637 -983351286 -981862719 -981320353 -977886047 -976776184 -974018304 -971019622 -968638131 -968212153 -965804945 -964163104 -963109548 -959196304 -957299359 -956845454 -956196044 -951834056 -948579546 -948470200 -946405888 -945342590 -942808561 -939890770 -937402809 -936699142 -930807969 -929336939 -924780470 -917895818 -916170526 -914806260 -911743869 -908220870 -907360561 -907267344 -904487646 -901167939 -900793564 -898292461 -896507838 -892631122 -888760958 -880965672 -877001998 -876970179 -875486258 -874972869 -873634189 -871682215 -871231787 -871033593 -870697693 -863657833 -863562027 -860843621 -857138683 -852009674 -847914613 -847852277 -845790419 -839087662 -838990600 -837…
Output: -1

Example 2:

Input: 598 -120508487 -996470813 -990060438 -986925050 -984744387 -984262367 -983908071 -982786076 -979750356 -978916630 -977450237 -976631047 -971948469 -969735883 -967249299 -965966884 -965670742 -964920533 -953419858 -952614244 -952296507 -951431881 -950767776 -949177965 -944308352 -943924068 -943474482 -942560107 -941676094 -941168114 -940114220 -939633157 -939402312 -937636877 -937117666 -936421954 -927174141 -926538975 -926067294 -924268330 -923440619 -919757944 -919261455 -918828727 -917496526 -915983047 -914298550 -910237891 -910208715 -908423622 -905869649 -905187429 -903193552 -900285830 -900207394 -900008512 -898493027 -892953446 -892200074 -891734212 -891441076 -891338343 -890250897 -888855871 -887302235 -887177730 -887081881 -886526053 -885195507 -880426405 -876952286 -876853713 -876…
Output: 530

Example 3:

Input: 694 -823189306 -997891414 -997262743 -995484240 -994481697 -993152123 -991764113 -989705868 -989313490 -988101265 -986645698 -985783836 -984146028 -980486794 -977427210 -971415442 -971362563 -969873591 -969069455 -967414275 -966744490 -965025807 -964084328 -963989294 -959569531 -959064824 -957871227 -955044187 -954731367 -954669399 -951221438 -949917159 -948350466 -948198806 -945396451 -944851485 -944753813 -943562256 -943395548 -942844988 -939706156 -938483514 -938379322 -935493928 -930715508 -929930859 -929698783 -929471649 -928832019 -925201664 -923771013 -923436738 -921643447 -921608297 -918734009 -917400439 -916988387 -916863479 -915686853 -915518858 -915374144 -913117322 -911601801 -909418256 -908952415 -908529638 -907685945 -906637408 -906088455 -901625885 -900195596 -898501453 -897…
Output: -1

Constraints:

1 <= n <= 702; -1000000000 <= a[i],x <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Steward's shelves Reckoning - EASY Coding Problem | CodeTikki