Submission #14165

# Submission time Handle Problem Language Result Execution time Memory
14165 2015-05-02T19:47:11 Z pichulia 버블 정렬 (OJUZ10_bubblesort) C++
0 / 100
49 ms 3036 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef pair<int, int> pii;
int n, m;
int a[100009];
pii b[100009];
int c[100009];
int d[100009];
void doo(int si,int ei)
{
	int i,j,k;
	sort(b+si,b+ei);
	for(i=0;i<m && ei-i-1>=si;i++)
	{
		c[b[ei-i-1].second] = 1;
	}
	k=si;
	for(i=si;i<ei;i++)
		if(c[i]==0)
			d[k++] = a[i];
	j=ei-m;
	if(j<si)j=si;
	for(;j<ei;j++)
	{
		d[k++] = b[j].first;
	}
}
int main()
{
	int i, j, k, l;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){scanf("%d",&a[i]);b[i].first = a[i];b[i].second = i; c[i]=0;}
	int cur=a[0];
	int ci=0;
	for(i=1;i<=n;i++)
	{
		if(i==n || cur <= a[i])
		{
			doo(ci,i);
			if(i==n)break;
			if(cur==a[i])ci=i;
			else {cur=a[i];ci=i;}
			continue;
		}
	}
	for(i=0;i<n;i++)
		printf("%d ",d[i]);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Incorrect 0 ms 3036 KB Output isn't correct
3 Correct 0 ms 3036 KB Output is correct
4 Incorrect 0 ms 3036 KB Output isn't correct
5 Incorrect 0 ms 3036 KB Output isn't correct
6 Incorrect 0 ms 3036 KB Output isn't correct
7 Incorrect 0 ms 3036 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3036 KB Output isn't correct
2 Incorrect 0 ms 3036 KB Output isn't correct
3 Incorrect 0 ms 3036 KB Output isn't correct
4 Incorrect 0 ms 3036 KB Output isn't correct
5 Incorrect 1 ms 3036 KB Output isn't correct
6 Incorrect 1 ms 3036 KB Output isn't correct
7 Incorrect 0 ms 3036 KB Output isn't correct
8 Incorrect 0 ms 3036 KB Output isn't correct
9 Incorrect 0 ms 3036 KB Output isn't correct
10 Incorrect 0 ms 3036 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 3036 KB Output isn't correct
2 Incorrect 36 ms 3036 KB Output isn't correct
3 Incorrect 31 ms 3036 KB Output isn't correct
4 Incorrect 39 ms 3036 KB Output isn't correct
5 Incorrect 31 ms 3036 KB Output isn't correct
6 Incorrect 32 ms 3036 KB Output isn't correct
7 Incorrect 32 ms 3036 KB Output isn't correct
8 Incorrect 34 ms 3036 KB Output isn't correct
9 Correct 33 ms 3036 KB Output is correct
10 Incorrect 39 ms 3036 KB Output isn't correct
11 Incorrect 42 ms 3036 KB Output isn't correct
12 Incorrect 45 ms 3036 KB Output isn't correct
13 Incorrect 16 ms 3036 KB Output isn't correct
14 Incorrect 34 ms 3036 KB Output isn't correct
15 Incorrect 45 ms 3036 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 3036 KB Output isn't correct
2 Incorrect 32 ms 3036 KB Output isn't correct
3 Incorrect 36 ms 3036 KB Output isn't correct
4 Incorrect 43 ms 3036 KB Output isn't correct
5 Incorrect 35 ms 3036 KB Output isn't correct
6 Incorrect 32 ms 3036 KB Output isn't correct
7 Incorrect 34 ms 3036 KB Output isn't correct
8 Incorrect 40 ms 3036 KB Output isn't correct
9 Incorrect 20 ms 3036 KB Output isn't correct
10 Incorrect 39 ms 3036 KB Output isn't correct
11 Incorrect 34 ms 3036 KB Output isn't correct
12 Correct 33 ms 3036 KB Output is correct
13 Incorrect 38 ms 3036 KB Output isn't correct
14 Incorrect 34 ms 3036 KB Output isn't correct
15 Incorrect 36 ms 3036 KB Output isn't correct