제출 #18591

#제출 시각아이디문제언어결과실행 시간메모리
18591jjhstop버블 정렬 (OJUZ10_bubblesort)C++98
34 / 100
1000 ms1472 KiB
#include<stdio.h> int data[100000]; int main() { int N, K; //freopen("input.txt", "r", stdin); scanf("%d %d ", &N, &K); for (int i = 0; i < N; i++) { scanf("%d ", &data[i]); } if (K >= N - 1) K = N - 1; for (int i = 0; i < K; i++) { for (int j = 0; j < N - 1 - i; j++) { if (data[j] > data[j + 1]) { int temp; temp = data[j]; data[j] = data[j + 1]; data[j + 1] = temp; } } } for (int i = 0; i < N; i++) printf("%d ", data[i]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...