fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <set>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. #pragma comment(linker, "/STACK:1677721600")
  10.  
  11. static const int MAXP = 666013, MULT = 10;
  12.  
  13. int a[MULT * MAXP];
  14.  
  15. void generate(){
  16. int x;
  17. srand(time(0));
  18. int poz = 0;
  19. do{
  20. for(int i = poz; i < MULT * MAXP; i++) {
  21. do{
  22. x = rand() * (1 << 15) + rand();
  23. } while(x < 0);
  24. a[i] = x;
  25. }
  26. sort(a, a + MULT * MAXP);
  27. poz = unique(a, a + MULT * MAXP) - a;
  28. } while(poz < MULT * MAXP);
  29. random_shuffle(a, a + MULT * MAXP);
  30. }
  31.  
  32. set<int> s;
  33.  
  34. void insertInSet() {
  35. cout << s.max_size() << endl;
  36. for(int i = 0; i < MULT * MAXP; i++) {
  37. s.insert(a[i]);
  38. }
  39. }
  40.  
  41. int main() {
  42. generate();
  43. insertInSet();
  44. s.clear();
  45. return 0;
  46. }
  47.  
  48.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout

Standard output is empty