çªå µæ³
æç´ã·ãã¥ã¬ã¼ã·ã§ã³ãããåé¡ããã ãããç¨åº¦ã¯è¨ç®éãç¥ããªãã¨ãããã«ãããå¯è½æ§ãããã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ããã·ã£ã¯ã¼ã¯ãã¹ã¤ãããæ¼ãã¨ãã®å¾ ç§éã湯ãåºã (延é·ããããã§ã¯ãªã)ã æå» (å調å¢å ) ã«ã¹ã¤ãããæ¼ããã¨ããâ¦
ã²ãã£ã¨ãããé£æ度 5 ã¨ã®å¢çã®åé¡ã ã£ããããããªããlower_bound() ã試ãããæãã®ä¾é¡ã ã¸ã£ãã¸ãã¼ã¸ã¸ã®ãªã³ã¯ åé¡æ editorial åé¡æ¦è¦ ä¸å¨ã®é·ãã ã§ãããããªå¨åã³ã¼ã¹ããã£ã¦ãã³ã¼ã¹ä¸ã« åã®åºèããããã³ã¼ã¹ä¸ã® 1 ç¹ã®åº§æ¨â¦
çªå µãå ¥ããã¨ãããã°ãæãã±ã¼ã¹ããããããé¤å»ã§ããã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ å·¦å³æ¹åä¸åã« åã®ãã¹ã並ãã§ãã¾ãã ãã® åã®ãã¹ã®ãã¡ããã¹ ã® åã®ãã¹ã¯éè²ã§ããã以å¤ã®ãã¹ã¯ç½è²ã§ãã ããªãã¯ä¸åã ããæ£æ´æ° ãä¸ã¤é¸ãã§å¹ ã®â¦
ããã«ã ã¤ãã åé¡ã¸ã®ãªã³ã¯ editorial åé¡æ¦è¦ ä¸å³ã§è¡¨ããããããªããã«ã ç¶ã®ã°ãªãããä¸ãããã (å³ã¯åé¡æãã)ã é»è²ãã¹ã¯å»ºç©ããããã¹ã表ãã¦ããã赤太ç·ã¯ããå¤å´ãããè¦ã¦è¦ããå¤å£ã表ãã¦ããã ãã®ãã㪠ã®ããããä¸ãããâ¦
æãåããã¦ã¿ãã¨ãã©ããªã£ã¦ãããè¦ãã¦ããï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ 人ãããããåº§æ¨ ã«ä¸¦ãã§ãã (å調å¢å ãè² ããããããå ã¯å¶æ°)ãããã¦æå» 0 ã«ããã¦ã 人ã¯ããããæ£ã®æ¹å ( ã§ä¸ãããã) ã¾ãã¯è² ã®æ¹å ( ã§ä¸ãããã) ã« 1 ç§â¦
å¤ãªã¨ããã§ããããªãããã«ããã... åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ã®é å ãä¸ããããããã¾ããããã®é åã®åè¦ç´ ã«å°ãã¤ãã¦ãããã¨ãèããããã ãããå°ã®ã¤ããè¦ç´ ãå·¦ããé ã«å調å¢å ã¨ãªãããã«ä¸¦ãã§ãããã¨ããæ¡ä»¶ã常ã«æºããå¿ è¦ãããâ¦
D åé¡ã¯ã³ã¼ãã¼ã±ã¼ã¹ã²ã¼ãã¨æã£ããããã§ããªãã£ããããããã£ã¡ã®æ¹ãè¦ããã£ãã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ è¦ç´ ãããªãé åã åãã£ã¦ãããããæå㯠ã§åæåããã¦ããã以ä¸ã®æä½ã åçµãã段éã§ã åã®é åãçããç¶æ ã¨ãããã¨ãå¯â¦
æåã¯ããï¼ï¼ i è¡ç®ã®æååæ å ±ããªã㨠i+1 è¡ç®ä»¥éã®ãã¨ãèããããªããªãï¼ãã¨ãªã£ã¦ãã¾ã£ã¦ãéæ¹ã«æ®ãã¦ãã¾ã£ã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ åã®æåå ããã£ã¦ãããããããã¤ãã®æå㯠'?' ã§é ããã¦ãã (ããã®ã¯ ã®ä¾) '?' å ¨ä½ãã¢â¦
é¢ç½ãã£ãã æ°åã®åºéã«å«ã¾ããå¤ã®ç¨®é¡æ°ãçããã¯ã¨ãªã«ç´ æ©ãçããæè¡ãå¿ è¦ã«ãªã£ãã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ããã®é ã«ä¸¦ãã§ããããããã åã®æä½ãè¡ãã åç®ã®èµ°æ»ã¯ã ä»¥ä¸ ä»¥ä¸ã®å¤ ã§è¡¨ãã ç¾å¨ã®é åã®ãã¡ãå¤ ãå é ã«ãã£ã¦ãâ¦
å¦ã³å¤ãåé¡ã åã«ã¨ã£ã¦ã¯å¾åã®ãã¼ã¿æ§é ãã¼ããè¦æ¦ãå¼·ããããæ¬å½ã«åå¼·ã«ãªã£ãï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ åã®å¯¿å¸ããã£ã¦ããããããã¿ ã¨ç¾å³ãã ããã£ã¦ããããã®ä¸ãã åã®å¯¿å¸ãé¸ã³ãããé¸ãã 寿å¸éåã®ã¹ã³ã¢ã¯ é¸ãã 寿å¸ã®ç¾â¦
ä¸ç®è¦ã¦ããã¼ã¿æ§é ãã¼ããª...ã¨æã£ã¦ãã¾ã£ããããããå å ¥è¦³ãæã¤ã¨å±ãªããå®éã¯å¥½ã¿ãªèå¯ã§è§£ããåé¡ã ã£ãã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ æ£ã®æ´æ° 㨠ãããªãé åãä¸ããããããã¾ããã®é åãä¸å³å·¦ã®ããã«ãã©ãããã®æåºè¾ºã«æ¸ãè¾¼ããâ¦
äºåæ¢ç´¢ã§ lower_bound ã¨ããã£ã¡ãç¡æèçã«ä½¿ãããªããããã«ãªãããã®ããªï¼ï¼ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ä¸æ¬¡å ã®ä¸çãèããã A åã®ç¥ç¤¾ã¨ãB åã®å¯ºã並ãã§ãã (åç¥ç¤¾ã¨å寺ã®ä½ç½®æ å ±ã 1 ã¤ã®æ´æ°å¤ã§ä¸ãããã)ã 以ä¸ã® Q åã®ã¯ã¨ãªâ¦