답안 #14066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14066 2015-04-26T05:51:47 Z sleep4725 버블 정렬 (OJUZ10_bubblesort) C
34 / 100
1000 ms 1476 KB
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	int i, j, k,m;
	int a;
	int b;
	int temp = 0;
	int c = 0;
	scanf("%d %d", &a, &b);
	int* arr = NULL;
	arr = (int*)malloc(sizeof(int)*a);
	for (i = 0; i < a; i++)
	{
		scanf("%d", &arr[i]);
	}
	while (1)
	{
		if (c == b)
		{
			break;
		}
		for (k = 0; k < a - 1; k++)
		{
			if (arr[k]>arr[k + 1])
			{
				temp = arr[k];
				arr[k] = arr[k + 1];
				arr[k + 1] = temp;

			}
		}
		c++;
	}
		for (m = 0; m < a; m++)
		{
			printf("%d ", arr[m]);
		}
		printf("\n");
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1084 KB Output is correct
2 Correct 4 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 2 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 3 ms 1084 KB Output is correct
9 Correct 7 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 1472 KB Program timed out
2 Execution timed out 1000 ms 1472 KB Program timed out
3 Execution timed out 1000 ms 1472 KB Program timed out
4 Execution timed out 1000 ms 1428 KB Program timed out
5 Execution timed out 1000 ms 1356 KB Program timed out
6 Correct 119 ms 1476 KB Output is correct
7 Correct 251 ms 1476 KB Output is correct
8 Correct 27 ms 1476 KB Output is correct
9 Execution timed out 1000 ms 1392 KB Program timed out
10 Correct 112 ms 1236 KB Output is correct
11 Execution timed out 1000 ms 1472 KB Program timed out
12 Correct 51 ms 1476 KB Output is correct
13 Correct 29 ms 1476 KB Output is correct
14 Execution timed out 1000 ms 1472 KB Program timed out
15 Execution timed out 1000 ms 1472 KB Program timed out
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1476 KB Output is correct
2 Execution timed out 1000 ms 1472 KB Program timed out
3 Correct 257 ms 1476 KB Output is correct
4 Execution timed out 1000 ms 1472 KB Program timed out
5 Correct 118 ms 1236 KB Output is correct
6 Execution timed out 1000 ms 1472 KB Program timed out
7 Execution timed out 1000 ms 1472 KB Program timed out
8 Correct 34 ms 1476 KB Output is correct
9 Execution timed out 1000 ms 1472 KB Program timed out
10 Execution timed out 1000 ms 1392 KB Program timed out
11 Execution timed out 1000 ms 1356 KB Program timed out
12 Correct 51 ms 1476 KB Output is correct
13 Correct 114 ms 1476 KB Output is correct
14 Execution timed out 1000 ms 1428 KB Program timed out
15 Execution timed out 1000 ms 1472 KB Program timed out