fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. const int range = (int)1e6;
  9. const int rand_max = (1 << 15) - 1;
  10. vector<int> ans (range);
  11. for (int i = 0; i <= rand_max; i++)
  12. for (int j = 0; j <= rand_max; j++)
  13. ans[i * j % range]++;
  14.  
  15. cout << "range = " << range << endl;
  16. cout << "rand_max = " << rand_max << endl;
  17. cout << "min occurences = " << *min_element(ans.begin(), ans.end()) << endl;
  18. cout << "max occurences = " << *max_element(ans.begin(), ans.end()) << endl;
  19. return 0;
  20. }
  21.  
Time limit exceeded #stdin #stdout 5s 19144KB
stdin
Standard input is empty
stdout
Standard output is empty