Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int nmax=1e5+3;
- long long v[nmax],usu,act;
- int n,nr,k;
- int main()
- {
- ifstream f ("tomi.in");
- f>>n>>k;
- for (int i=1; i<=n;++i)
- f>>v[i];
- usu=(1ll<<60)-1ll;
- for(long long int i=59;i>=0;--i)
- {
- act=usu^(1ll<<i);
- nr=0;
- for(int j=1;j<=n;++j)
- if((v[j]|act)==act)
- ++nr;
- if(nr>=k)
- usu=act;
- }
- ofstream g ("tomi.out");
- g<<usu<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement