Problem : 1425 ( sort ) Judge Status : Accepted
RunId : 7412949 Language : C Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
#include <stdio.h> #include <string.h> #include <stdlib.h> #define N 1000100 #define M 500000 int arr[1000100]; int main() { int m,n,i,tmp,max; while(scanf("%d%d",&m,&n)!=EOF) { memset(arr,0x3f3f3f3f,sizeof(arr)); max = -1*N; for (i = 0; i < m; i++) { scanf("%d",&tmp); arr[tmp+M] = tmp; max = max>(tmp+M)?max:(tmp+M); } for(i = max;i>=0 && n!=0;i--) { if(n!=0 && arr[i]!=0x3f3f3f3f) { printf("%d",arr[i]); n--; if(n == 0) printf("\n"); else printf(" "); } } } return 0; }