2022-01-01ãã1ã¶æéã®è¨äºä¸è¦§
å»å¹´æ«ã«ããã¨è¨ã£ã¦ãããã§ããããã£ã¨çµããã¾ããã ã¯ã¨ãªã§ä¸ããããåºéã®æé·å¢å é¨ååã®é·ããçãããã¤ã§ãè¨ç®é㯠\(\langle O(n\log(n)^2), O(\log(n))\rangle\) ã§ãã å®è£ åã«ã¤ã¡ã¼ã¸ãã¤ãã«ããã£ãã®ã¨ããã£ãã楽ããããªã¨æã£â¦
次ã®æä½ãã§ããåªå 度ã¤ããã¥ã¼ã®ãã¯ãªãã§ãã push(x)ï¼x ãæ¿å ¥ãã pop_newest(k)ï¼æ¿å ¥é ãæ°ããæ¹ãã k 以å ã®è¦ç´ ã®æ大å¤ãåå¾ã»åé¤ pop_oldest(k)ï¼æ¿å ¥é ãå¤ãæ¹ãã k 以å ã®è¦ç´ ã®æ大å¤ãåå¾ã»åé¤ åå¾ã ããã peek_newest(k), peeâ¦
ããã§åºé \(k\)-æå°å¤ã¨å¼ãã§ããã®ã¯ä»¥ä¸ã®ãããªåé¡ã§ãã æåã«é å \(a = (a_0, a_1, \dots, a_{n-1})\) ãä¸ãããããã 次ã«ã¯ã¨ãªå¦çã \(q\) åãã¦ãã ã¯ã¨ãªã¯ \( ([l, r), k)\) ã®å½¢å¼ã§ä¸ããããã®ã§ã\(a_l, a_{l+1}, \dots, a_{r-1}â¦