Advertisement
Guest User

alt sum gen 1 - 10

a guest
Jul 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include "testlib.h"
  2. #include "bits/stdc++.h"
  3. #define ll long long
  4. #define rep(i,a,b) for(ll int i=a;i<b;i++)
  5. #define pii pair<ll,ll>
  6. #define sz(x) (ll)(x.size())
  7. #define pb push_back
  8. #define all(a) ((a.begin()),(a.end()))
  9. using namespace std;
  10.  
  11. void writeTest(int test){
  12. startTest(test);
  13. /***********************************/
  14. unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
  15. mt19937_64 generator (seed);
  16. /***********************************/
  17. ll N=1000;
  18. ll Q=500000;
  19. ll V=1000000001;
  20. /*****************/
  21.  
  22. ll n=generator()%(N-1)+2;
  23. ll m=(n*(n-1))/2;
  24. cout<<n<<" "<<m<<endl;
  25. queue<ll>q;
  26. ll cnt=n-1;
  27. q.push(n);
  28. while(cnt>0)
  29. {
  30. ll vl=q.front();
  31. q.pop();
  32. ll ch=generator()%20+1;
  33. if(ch>=cnt)
  34. {
  35. ch=cnt;
  36. }
  37. rep(i,0,ch)
  38. {
  39. ll num=generator()%V;
  40. if(generator()%2)
  41. {
  42. num=-num;
  43. }
  44. cout<<vl<<" "<<cnt<<" "<<num<<endl;
  45. q.push(cnt);
  46. cnt--;
  47. }
  48. }
  49. rep(i,1,n+1)
  50. {
  51. rep(j,i+1,n+1)
  52. {
  53. cout<<i<<" "<<j<<endl;
  54. }
  55. }
  56. }
  57. int main(int argc, char* argv[])
  58. {
  59. registerGen(argc, argv, 1);
  60. for(int i=1;i<=10;i++){
  61. writeTest(i);
  62. }
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement