This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <queue>
using namespace std;
int data[100005];
priority_queue<int, vector<int>, greater<int> > q;
int main() {
int N, K;
scanf("%d %d", &N, &K);
for (int i = 0; i < N; i++) scanf("%d", &data[i]);
for (int i = 0; i < K; i++) q.push(data[i]);
for (int i = K; i < N; i++) {
q.push(data[i]);
printf("%d ", q.top());
q.pop();
}
while (!q.empty()) {
printf("%d ", q.top());
q.pop();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |