fork download
  1. #include "bits/stdc++.h"
  2.  
  3. using namespace std;
  4.  
  5. mt19937 rng(123);
  6.  
  7. int main() {
  8. unordered_map<int, int> m;
  9. vector<int> v;
  10. for (int i = 0; i < 1234567; ++i) {
  11. m[rng() % (int)1e9]++;
  12. int c = m.bucket_count();
  13. if (v.empty() || c != v.back()) {
  14. v.push_back(c);
  15. cout << m.size() << ' ' << c << endl;
  16. }
  17. }
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.65s 61148KB
stdin
Standard input is empty
stdout
1 2
3 5
6 11
12 23
24 47
48 97
98 199
200 409
410 823
824 1741
1742 3739
3740 7517
7518 15173
15174 30727
30728 62233
62234 126271
126272 256279
256280 520241
520242 1056323
1056324 2144977