-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht1.cpp
More file actions
60 lines (57 loc) · 1.58 KB
/
t1.cpp
File metadata and controls
60 lines (57 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define nl "\n"
#define maxe(a) (*max_element(a.begin(), a.end()))
#define mine(a) (*min_element(a.begin(), a.end()))
#define all(a) a.begin(), a.end()
#define lsb(n) (n & -n)
#define msb(n) (1LL << (63 - __builtin_clzll(n)))
#define nsb(n) (__builtin_popcountll(n))
#define len(n) (to_string(n).size())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll random(ll a, ll b) {
return uniform_int_distribution<ll>(a, b)(rng);
}
void solve() {
ll n = 1e4, i, j, k, m = 100, t = 16;
ld tot = 0;
ll mx = 0;
for(i=0; i<n; i++) {
vector<vector<ll>> pers(t, vector<ll>(m));
for(j=0; j<t; j++) {
iota(all(pers[j]), 0);
shuffle(all(pers[j]), rng);
}
vector<ll> vis(m, 0), used;
for(j=0; j<m; j++) {
for(k=0; k<t; k++) {
if(!vis[pers[k][j]]) {
used.push_back(pers[k][j]);
}
}
for(k=0; k<t; k++) {
vis[pers[k][j]] = 1;
}
}
tot += used.size();
mx = max(mx, (ll)used.size());
}
tot /= n;
cout << tot << " " << mx << nl;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t = 1;
cin >> t;
for (int i = 0; i < t; i++) {
solve();
}
return 0;
}