ghorardim

CF

Nov 20th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4. #include<ctype.h>
  5. #include<stdlib.h>
  6. #include<cstdio>
  7. #include<cstring>
  8. #include<string>
  9. #include<cmath>
  10. #include<iostream>
  11. #include<cctype>
  12. #include<map>
  13. #include<stack>
  14. #include<cstdlib>
  15. #include<queue>
  16. #include<vector>
  17. #include<algorithm>
  18. #include<bitset>
  19. #include<algorithm>
  20. #include<set>
  21. #include<limits.h>
  22.  
  23. using namespace std;
  24. typedef long int LD;
  25. typedef long long int LLD;
  26. typedef float F;
  27. typedef double LF;
  28. typedef unsigned int U;
  29. typedef unsigned long int LU;
  30. typedef unsigned long long int LLU;
  31. typedef char C;
  32.  
  33. #define sf scanf
  34. #define sfi(x) scanf("%d",&x)
  35. #define sfc(x) scanf("%c",&x)
  36. #define sfi2(x,y) scanf("%d%d",&x,&y)
  37. #define sfl(x) scanf("%ld",&x)
  38. #define sfll(x) scanf("%lld",&x)
  39. #define sfu(x) scanf("%llu",&x)
  40. #define sfs(x) scanf("%s",x)
  41. #define pf printf
  42. #define pfi(x) printf("%d\n",x)
  43. #define pfl(x) printf("%ld\n",x)
  44. #define pfll(x) printf("%lld\n",x)
  45. #define pfu(x) printf("%llu\n",x)
  46. #define pfs(x) printf("%s\n",x)
  47. #define pfc(x) printf("%c\n",x)
  48. #define pb(x)     push_back(x)
  49. #define PI acos(-1.0)
  50. #define sq(x) (x)*(x)
  51. #define nn printf("\n")
  52. // xx-> diagonal -> 8 horizontal/vertical->4
  53.  
  54. const int xx[] = {0, 1, 0, -1, -1, 1, -1, 1};
  55. const int yy[] = {1, 0, -1, 0, 1, 1, -1, -1};
  56.  
  57. // KX-> Knight moves
  58. const int kx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
  59. const int ky[] = {1, 2, 2, 1, -1, -2, -2, -1};
  60.  
  61.  
  62. /******** debug **********/
  63. #define chk1  printf("hi......1\n")
  64. #define chk2  printf("hi......2\n")
  65.  
  66.  
  67.  
  68.  
  69. #define mod 1000003
  70. #define eps 10e-8
  71. #define sz 1002
  72. #define sz1 1004
  73. #define sz2 15
  74. /*******   start my code   ********/
  75. class data
  76. {
  77. public:
  78.     int x,y;
  79.     data()
  80.     {
  81.         x=y=0;
  82.     }
  83. };
  84. data arr[sz];
  85. bool compare(data a,data b)
  86. {
  87.     return a.y>b.y;
  88. }
  89. bool compare2(data a,data b)
  90. {
  91.     return a.x<b.x;
  92. }
  93. int main()
  94. {
  95.     int i,j,k,n;
  96.     bool key;
  97.     sfi2(n,k);
  98.     for(i=0;i<n;i++)
  99.     {
  100.         arr[i].x=i+1;
  101.         sfi(arr[i].y);
  102.     }
  103.     sort(arr,arr+n,compare);
  104.     pfi(arr[k-1].y);
  105. //    for(i=0;i<n;i++)
  106. //        pf("%d ",arr[i].y);nn;
  107.     sort(arr,arr+k,compare2);
  108.     for(i=0;i<k;i++)
  109.         pf("%d ",arr[i].x);
  110.     return 0;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment