Advertisement
tiom4eg

max clique

May 16th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.99 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. // tiom4eg's precompiler options
  3. // POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS
  4. // IO settings
  5. #define fastIO ios_base::sync_with_stdio(false); cin.tie(0)
  6. // Quick types
  7. #define ll long long
  8. #define ld double
  9. #define ull unsigned long long
  10. #define pii pair <int, int>
  11. #define pll pair <ll, ll>
  12. #define vi vector <int>
  13. #define mi vector <vector <int> >
  14. // Quick functions
  15. #define endl "\n"
  16. #define F first
  17. #define S second
  18. #define all(a) a.begin(), a.end()
  19. #define sz(a) a.size()
  20. #define pb push_back
  21. #define mp make_pair
  22. #define min(a, b) ((a < b) ? (a) : (b))
  23. #define max(a, b) ((a > b) ? (a) : (b))
  24. // Quick fors
  25. #define FOR(i, a, b) for (int i = a; i < b; ++i)
  26. #define RFOR(i, a, b) for (int i = a; i >= b; --i)
  27. // Pragmas
  28. #pragma GCC optimize("O3,unroll-loops") // let the chaos begin!
  29. //#pragma GCC target("avx,avx2,bmi,bmi2,popcnt,lzcnt,tune=native")
  30. #pragma GCC comment(linker, "/stack:200000000")
  31. // PBDS
  32. #include <ext/pb_ds/assoc_container.hpp>
  33. #include <ext/pb_ds/tree_policy.hpp>
  34. #define ordered_set tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update>
  35. #define ook order_of_key
  36. #define fbo find_by_order
  37. // POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS
  38. using namespace std;
  39. using namespace __gnu_pbds;
  40. mt19937 rng(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
  41. #define int long long
  42.  
  43. signed main() {
  44.     srand(rng());
  45.     fastIO;
  46.     cout << fixed << setprecision(9);
  47.     int n, k; cin >> n >> k;
  48.     vi adj(n);
  49.     FOR(i, 0, n) FOR(j, 0, n) {
  50.         int x; cin >> x;
  51.         adj[i] |= (x << j);
  52.     }
  53.     vi p(n); FOR(i, 0, n) p[i] = i;
  54.     int best = 0;
  55.     FOR(iter, 0, 100000) {
  56.         random_shuffle(all(p));
  57.         int cur = 0, mask = (1LL << n) - 1;
  58.         FOR(i, 0, n) if ((mask >> p[i]) & 1) cur++, mask &= adj[p[i]];
  59.         best = max(best, cur);
  60.     }
  61.     cout << 0.5 * k * k * (best - 1) / best;
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement