{"problem":{"name":"Prefix K-th Max","description":{"content":"Given are a permutation $P=(P_1,P_2,\\ldots,P_N)$ of $(1,2,\\ldots,N)$ and a positive integer $K$. For each $i=K,K+1,\\ldots,N$, find the following. *   The $K$\\-th greatest value among the first $i$ te","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc234_d"},"statements":[{"statement_type":"Markdown","content":"Given are a permutation $P=(P_1,P_2,\\ldots,P_N)$ of $(1,2,\\ldots,N)$ and a positive integer $K$.\nFor each $i=K,K+1,\\ldots,N$, find the following.\n\n*   The $K$\\-th greatest value among the first $i$ terms of $P$.\n\n## Constraints\n\n*   $1 \\leq K \\leq N \\leq 5 \\times 10^5$\n*   $(P_1,P_2,\\ldots,P_N)$ is a permutation of $(1,2,\\ldots,N)$.\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$\n$P_1$ $P_2$ $\\ldots$ $P_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc234_d","tags":[],"sample_group":[["3 2\n1 2 3","1\n2\n\n*   The $(K=)$ $2$\\-nd greatest value among the first $2$ terms of $P$, $(P_1,P_2)=(1,2)$, is $1$.\n*   The $(K=)$ $2$\\-nd greatest value among the first $3$ terms of $P$, $(P_1,P_2,P_3)=(1,2,3)$, is $2$."],["11 5\n3 7 2 5 11 6 1 9 8 10 4","2\n3\n3\n5\n6\n7\n7"]],"created_at":"2026-03-03 11:01:14"}}