Advertisement
a53

tomi

a53
Jan 26th, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int nmax=1e5+3;
  4. long long v[nmax],usu,act;
  5. int n,nr,k;
  6.  
  7. int main()
  8. {
  9. ifstream f ("tomi.in");
  10. f>>n>>k;
  11. for (int i=1; i<=n;++i)
  12. f>>v[i];
  13. usu=(1ll<<60)-1ll;
  14.  
  15. for(long long int i=59;i>=0;--i)
  16. {
  17. act=usu^(1ll<<i);
  18. nr=0;
  19. for(int j=1;j<=n;++j)
  20. if((v[j]|act)==act)
  21. ++nr;
  22. if(nr>=k)
  23. usu=act;
  24. }
  25. ofstream g ("tomi.out");
  26. g<<usu<<'\n';
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement