CT28710

Ranger Counts the ledgers

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

It is audit day at the marble forum of Argentium. Ranger spreads the ledgers records across the table and picks up a sharp pencil. Task: The array is sorted non-decreasing. Print the 1-based position where x would be inserted to keep the order (before equal values). Input format: First line: n and x. Second line: n sorted integers. Output format: Print the insertion position (1..n+1). Constraints: 1 <= n <= 835; -1000000000 <= a[i],x <= 1000000.

Example 1:

Input: 732 -687790149 -996554784 -995232234 -994227716 -993651313 -992937405 -992929178 -991325950 -990931997 -990680997 -986846830 -986643098 -982730326 -982590099 -981975047 -981538600 -979126891 -978815764 -976781157 -975456372 -975312715 -973065569 -971906399 -968760422 -967982306 -967077049 -965607322 -963436074 -963326253 -963046895 -961719549 -960795271 -959274922 -959067173 -958539782 -958268837 -957837395 -955958537 -952614257 -952244881 -947403789 -946764094 -946073252 -944830954 -944760105 -944260611 -943924351 -943544865 -941944637 -935762033 -934956343 -934939379 -933777916 -932125366 -932091235 -931429850 -930084863 -929580041 -929348353 -927451410 -927067864 -925441503 -924369798 -923902791 -919738412 -918971497 -916971891 -914476278 -913295001 -913270394 -910375921 -910313772 -909…
Output: 210

Example 2:

Input: 793 -569424230 -998697739 -998109205 -994956903 -994550042 -992494763 -990170359 -989990724 -988572941 -984614803 -981885440 -981533183 -981318084 -980059460 -979580297 -977730650 -971136720 -970514637 -970352162 -969869138 -969413047 -967656655 -967570314 -965365836 -965311729 -964601355 -964229273 -964130052 -958655794 -956724066 -956324354 -955347221 -952640675 -952592356 -952419224 -951709271 -950840212 -950505624 -949127070 -949028713 -948941436 -945858653 -943888710 -942830867 -939674034 -935670945 -935323486 -933926929 -933685594 -933427643 -933021319 -932258256 -931764889 -930833509 -929191146 -928919606 -926524861 -925344400 -924142040 -924079400 -923601258 -920449445 -918871655 -916666382 -914557334 -913662692 -912919497 -911538556 -910904086 -909531764 -908756270 -908460345 -905…
Output: 343

Example 3:

Input: 198 -760090388 -998612321 -998379848 -995742330 -991048745 -982434566 -975021944 -965208303 -946703593 -940474374 -935110777 -931830352 -923903114 -923800495 -907454388 -903805040 -902714103 -897760729 -882010058 -868673796 -865986450 -865806059 -864615650 -863794177 -863329650 -843782072 -827664340 -818181908 -812668940 -811668862 -807512794 -800109634 -798877260 -796261113 -791391882 -779437939 -779279497 -769550227 -767515276 -764262560 -762786969 -759498331 -758496593 -758218299 -757538184 -754057214 -752961326 -746785200 -746155642 -732555867 -728392661 -724561513 -720150450 -713706469 -710747897 -707937262 -677891438 -675616585 -668952500 -667823306 -659154045 -654019335 -646081840 -632124890 -623993103 -621494279 -621072151 -614944191 -612973923 -610392036 -609613867 -607530555 -603…
Output: 41

Constraints:

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

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