Advertisement
Josif_tepe

Untitled

Oct 27th, 2022
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5. int n;
  6. int arr[2002];
  7. vector<pair<int, int> > g[2005];
  8.  
  9. int main() {
  10. cin >> n;
  11. for(int i = 0; i < n; i++) {
  12. cin >> arr[i];
  13.  
  14. for(int j = 0; j < (1 << 12); j++) {
  15. if(__builtin_popcount(j) == __builtin_popcount(arr[i])) {
  16. int p = (j ^ arr[i]);
  17. g[i].push_back(make_pair(j, __builtin_popcount(p) / 2));
  18. }
  19. }
  20. }
  21. return 0;
  22. }
  23. // 110000000000
  24. // 000000000011
  25.  
  26. // 110000000011
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement