gen.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #include "testlib.h"
  2. #include <iostream>
  3. #include <sstream>
  4. #include <fstream>
  5. #include <iomanip>
  6. #include <string>
  7. #include <cstdlib>
  8. #include <cstdio>
  9. #include <cstring>
  10. #include <cmath>
  11. #include <ctime>
  12. #include <climits>
  13. #include <cassert>
  14. #include <vector>
  15. #include <queue>
  16. #include <stack>
  17. #include <deque>
  18. #include <set>
  19. #include <map>
  20. #include <bitset>
  21. #include <utility>
  22. #include <algorithm>
  23. #define forn(i, n) for (int i = 0; i < int(n); i++)
  24. using namespace std;
  25. int main(int argc, char* argv[])
  26. {
  27. registerGen(argc, argv, 1);
  28. int n = opt<int>(1);
  29. int t = opt<int>(2);
  30. vector<int> p(n);
  31. forn(i, n)
  32. if (i > 0)
  33. p[i] = rnd.wnext(i, t);
  34. println(n);
  35. vector<int> perm(n);
  36. forn(i, n)
  37. perm[i] = i;
  38. shuffle(perm.begin() + 1, perm.end());
  39. vector<pair<int,int> > edges;
  40. for (int i = 1; i < n; i++)
  41. if (rnd.next(2))
  42. edges.push_back(make_pair(perm[i], perm[p[i]]));
  43. else
  44. edges.push_back(make_pair(perm[p[i]], perm[i]));
  45. shuffle(edges.begin(), edges.end());
  46. for (int i = 0; i + 1 < n; i++)
  47. println(edges[i].first + 1, edges[i].second + 1);
  48. println(rnd.next("[a-z]{100}"));
  49. printf("%.04f\n", rnd.next(3.1415));
  50. {
  51. long long LL = 12345678901234LL;
  52. long long LR = 82345678901234LL;
  53. println(rnd.next(LL, LR));
  54. }
  55. {
  56. unsigned long long LL = 1345678901234ULL;
  57. unsigned long long LR = 8345678901234ULL;
  58. println(rnd.next(LL, LR));
  59. }
  60. {
  61. unsigned long LL = 134567UL;
  62. unsigned long LR = 834567UL;
  63. println(rnd.next(LL, LR));
  64. }
  65. {
  66. int LL = 134567;
  67. int LR = 834567;
  68. println(rnd.next(LL, LR));
  69. }
  70. vector<int> a;
  71. forn(i, 100)
  72. a.push_back(i * i);
  73. println(rnd.any(a));
  74. println(rnd.perm(10));
  75. println(rnd.perm(0));
  76. println(rnd.perm(0, 1));
  77. println(rnd.perm(10, 1));
  78. println(rnd.distinct(10, 15, 100));
  79. println(rnd.distinct(0, 15, 100));
  80. println(rnd.partition(10, 100, 3));
  81. println(rnd.partition(0, 0, 10));
  82. println(rnd.partition(1, 0, 0));
  83. println(rnd.wnext(1000, 2));
  84. println(rnd.wnext(1000LL, 2LL));
  85. println(rnd.wnext(1000, 20));
  86. println(rnd.wnext(1000LL, 20LL));
  87. println(rnd.wnext(100000, 200));
  88. println(rnd.wnext(100000LL, 200LL));
  89. }