Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- // tiom4eg's precompiler options
- // POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS
- // IO settings
- #define fastIO ios_base::sync_with_stdio(false); cin.tie(0)
- // Quick types
- #define ll long long
- #define ld double
- #define ull unsigned long long
- #define pii pair <int, int>
- #define pll pair <ll, ll>
- #define vi vector <int>
- #define mi vector <vector <int> >
- // Quick functions
- #define endl "\n"
- #define F first
- #define S second
- #define all(a) a.begin(), a.end()
- #define sz(a) a.size()
- #define pb push_back
- #define mp make_pair
- #define min(a, b) ((a < b) ? (a) : (b))
- #define max(a, b) ((a > b) ? (a) : (b))
- // Quick fors
- #define FOR(i, a, b) for (int i = a; i < b; ++i)
- #define RFOR(i, a, b) for (int i = a; i >= b; --i)
- // Pragmas
- #pragma GCC optimize("O3,unroll-loops") // let the chaos begin!
- //#pragma GCC target("avx,avx2,bmi,bmi2,popcnt,lzcnt,tune=native")
- #pragma GCC comment(linker, "/stack:200000000")
- // PBDS
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/tree_policy.hpp>
- #define ordered_set tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update>
- #define ook order_of_key
- #define fbo find_by_order
- // POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS
- using namespace std;
- using namespace __gnu_pbds;
- mt19937 rng(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
- #define int long long
- signed main() {
- srand(rng());
- fastIO;
- cout << fixed << setprecision(9);
- int n, k; cin >> n >> k;
- vi adj(n);
- FOR(i, 0, n) FOR(j, 0, n) {
- int x; cin >> x;
- adj[i] |= (x << j);
- }
- vi p(n); FOR(i, 0, n) p[i] = i;
- int best = 0;
- FOR(iter, 0, 100000) {
- random_shuffle(all(p));
- int cur = 0, mask = (1LL << n) - 1;
- FOR(i, 0, n) if ((mask >> p[i]) & 1) cur++, mask &= adj[p[i]];
- best = max(best, cur);
- }
- cout << 0.5 * k * k * (best - 1) / best;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement