package P2032;
import java.util.*;
class struct implements Comparable<struct> {
public short num;
public int id;
public int compareTo(struct B) {
return B.num - this.num;
}
}
public class P2032 {
static Comparator<struct> cmp = new Comparator<struct>() {
public int compare(struct A, struct B) {
return B.num - A.num;
}
};
public static void main(String[] args) {
int n, k;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
k = sc.nextInt();
struct stk[] = new struct[235502];
for (int i = 0; i < n; i++) {
stk[i] = new struct();
stk[i].num = sc.nextShort();
stk[i].id = i;
}
PriorityQueue<struct> pq = new PriorityQueue<>();
for (int i = 0; i < n; i++) {
pq.add(stk[i]);
if (i >= k - 1) {
while (pq.peek().id < i - k + 1)
pq.poll();
System.out.println(pq.peek().num);
}
stk[i]=null;
}
}
}
JAVA的,MLE一个点,谢谢您