Submission #14430

# Submission time Handle Problem Language Result Execution time Memory
14430 2015-05-14T10:37:40 Z ainta 버블 정렬 (OJUZ10_bubblesort) C++
100 / 100
68 ms 2660 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int n, K, H[101000], P[101000], top;
struct A{
	int a, num;
	bool operator<(const A &p)const{
		return a < p.a;
	}
}w[101000];
int main(){
	int i;
	scanf("%d%d", &n, &K);
	for (i = 1; i <= n; i++){
		scanf("%d", &w[i].a);
		w[i].num = i;
	}
	sort(w + 1, w + n + 1);
	for (i = 1; i <= n; i++){
		P[w[i].num] = i;
	}
	for (i = 1; i <= n + K; i++){
		if (i <= n){
			H[top++] = -P[i];
			push_heap(H, H + top);
		}
		if (i <= K)continue;
		printf("%d ", w[-H[0]].a);
		pop_heap(H, H + top);
		top--;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2660 KB Output is correct
2 Correct 0 ms 2660 KB Output is correct
3 Correct 0 ms 2660 KB Output is correct
4 Correct 0 ms 2660 KB Output is correct
5 Correct 0 ms 2660 KB Output is correct
6 Correct 0 ms 2660 KB Output is correct
7 Correct 0 ms 2660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2660 KB Output is correct
2 Correct 0 ms 2660 KB Output is correct
3 Correct 0 ms 2660 KB Output is correct
4 Correct 0 ms 2660 KB Output is correct
5 Correct 0 ms 2660 KB Output is correct
6 Correct 0 ms 2660 KB Output is correct
7 Correct 0 ms 2660 KB Output is correct
8 Correct 1 ms 2660 KB Output is correct
9 Correct 0 ms 2660 KB Output is correct
10 Correct 0 ms 2660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2660 KB Output is correct
2 Correct 48 ms 2660 KB Output is correct
3 Correct 56 ms 2660 KB Output is correct
4 Correct 59 ms 2660 KB Output is correct
5 Correct 57 ms 2660 KB Output is correct
6 Correct 57 ms 2660 KB Output is correct
7 Correct 60 ms 2660 KB Output is correct
8 Correct 43 ms 2660 KB Output is correct
9 Correct 43 ms 2660 KB Output is correct
10 Correct 45 ms 2660 KB Output is correct
11 Correct 58 ms 2660 KB Output is correct
12 Correct 36 ms 2660 KB Output is correct
13 Correct 23 ms 2660 KB Output is correct
14 Correct 57 ms 2660 KB Output is correct
15 Correct 57 ms 2660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2660 KB Output is correct
2 Correct 39 ms 2660 KB Output is correct
3 Correct 53 ms 2660 KB Output is correct
4 Correct 68 ms 2660 KB Output is correct
5 Correct 58 ms 2660 KB Output is correct
6 Correct 57 ms 2660 KB Output is correct
7 Correct 43 ms 2660 KB Output is correct
8 Correct 37 ms 2660 KB Output is correct
9 Correct 59 ms 2660 KB Output is correct
10 Correct 40 ms 2660 KB Output is correct
11 Correct 57 ms 2660 KB Output is correct
12 Correct 47 ms 2660 KB Output is correct
13 Correct 52 ms 2660 KB Output is correct
14 Correct 43 ms 2660 KB Output is correct
15 Correct 40 ms 2660 KB Output is correct