Submission #14286

#TimeUsernameProblemLanguageResultExecution timeMemory
14286jang718버블 정렬 (OJUZ10_bubblesort)C++98
0 / 100
55 ms2644 KiB
#include<stdio.h> #include<algorithm> using namespace std; int a[100010],visit[100010]; struct data{ int num,g; }b[100010]; int cmp(const data&p,const data&q){return p.g<q.g;} int main() { int n,k,i,j; scanf("%d%d",&n,&k); for(i=1;i<=n;i++){scanf("%d",&a[i]);b[i].g=a[i];b[i].num=i;} sort(b+1,b+n+1,cmp); for(i=n;i>n-k;i--)visit[b[i].num]=1; for(i=1;i<=n;i++)if(visit[i]==0)printf("%d ",a[i]); for(i=n-k+1;i<=n;i++)printf("%d ",b[i].g); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...