Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. int main()
  2. {
  3. cin >> n >> k >> x ;
  4.  
  5. for( int i = 0 ; i < n ; i++ )
  6. {
  7. scanf("%d", &a[i] ) ;
  8. }
  9. sort( a, a+ n );
  10. mx = a[n-1] ;
  11. mn = a[n] ;
  12. int cnt = 0 ;
  13. while(cnt < k )
  14. {
  15. cnt++ ;
  16. for( int i = 0 ; i < n ; i+= 2 ) a[i] = a[i] ^ x ;//, cout << a[i] << endl ;
  17. sort( a , a + n ) ;
  18. mn = a[0] ;
  19. mx = a[n-1] ;
  20.  
  21. }
  22.  
  23. cout << mx << " " << mn ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement