Advertisement
Zeinab_Hamdy

Untitled

Jul 17th, 2022
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. #define ull unsigned long long
  4. #define nl cout<<"\n";
  5. #define sp cout<<" ";
  6. #define sz(x) x.size()
  7. #define NumOfDigit(w) log10(w) + 1
  8. #define fill(arr, val)  memset(arr, val , sizeof(arr))
  9.  
  10. #define PI 3.141592654
  11. #define modulo(a, b, mod) ((((a) % (mod)) + ((b) % (mod))) % (mod))
  12. #define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  13. #define all(v) v.begin(), v.end()
  14. #define rall(v) v.rbegin(), v.rend()
  15. #define cin(v) for (auto&i:v) cin >> i;
  16. #define cout(v) for (auto&i:v) cout << i << " ";
  17. #define fixed(n) fixed << setprecision(n)
  18. #define fi first
  19. #define se second
  20. using namespace std;  
  21. void zainab_hamdy(){
  22.   ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  23.  //freopen("collisions.in" , "r" ,stdin);
  24.   #ifndef ONLINE_JUDGE  
  25.      freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  26.  #endif  
  27.  
  28. }
  29. bool prime(ll n){
  30.   if(n==2 || n==3) return true;
  31.   if(n<2 || n%2==0  ) return false;
  32.   for(int i=3;i<=sqrt(n);i+=2)   if(n%i==0) return false;
  33.   return true;
  34. }
  35.  
  36. bool comp(ll a , ll b){
  37.     return a > b;
  38. }
  39. int main(){
  40. //zainab_hamdy();
  41.  freopen("input.txt", "r", stdin);
  42.  freopen("output.txt", "w", stdout);
  43. ll n,k; cin >> n  >> k;
  44. vector<pair<int,int>> v(n);
  45. for(int i=0;i<n;i++){
  46.     cin >> v[i].first ;
  47.     v[i].second=i+1;
  48. }
  49. sort(rall(v));
  50. vector<int> ans(k);
  51. //for(auto& i:v) cout << i.fi <<" " << i.se <<"\n";
  52. for(int i=0;i<k;i++)
  53.     ans.push_back(v[i].second);
  54.  
  55. sort(all(ans));
  56. for(auto& i:ans)if(i!=0) cout << i<<" ";
  57.  
  58.  return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement