Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <bitset>
  3. #include <algorithm>
  4. #include <memory.h>
  5. #include <utility>
  6. #include <vector>
  7. #include <time.h>
  8. #include <assert.h>
  9. #include <chrono>
  10. #include <random>
  11.  
  12. #define ll long long
  13.  
  14. using namespace std;
  15.  
  16. const int N = (int)123;
  17.  
  18. mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  19.  
  20. string s[] = {"Artur", "Islam", "Try", "Doni", "Mirbek bro", "Abil", "Omur", "Shabdan"};
  21. vector < int > gr[N];
  22. string S[N];
  23.  
  24. void dfs(int v) {
  25.     int res = uniform_int_distribution<int>(0, 999)(rng);
  26.     res %= 2;
  27.     if (gr[v].size() == 0) {
  28.         S[v] = s[v - 8];
  29.         return ;
  30.     }
  31.     dfs(gr[v][0]);
  32.     dfs(gr[v][1]);
  33.     if (res == 0) {
  34.         S[v] = S[gr[v][0]];
  35.     } else {
  36.         S[v] = S[gr[v][1]];
  37.     }
  38. }
  39.  
  40. void jdi() {
  41.     double now = clock() * 1.0 / CLOCKS_PER_SEC;
  42.     int asd = 0;
  43.     while (clock() * 1.0 / CLOCKS_PER_SEC - now <= 3) {
  44.         asd++;
  45.     }
  46. }
  47.  
  48. main() {
  49.     shuffle(s, s + 8, rng);
  50.     gr[1].push_back(2);
  51.     gr[1].push_back(3);
  52.     gr[2].push_back(4);
  53.     gr[2].push_back(5);
  54.     gr[3].push_back(6);
  55.     gr[3].push_back(7);
  56.     gr[4].push_back(8);
  57.     gr[4].push_back(9);
  58.     gr[5].push_back(10);
  59.     gr[5].push_back(11);
  60.     gr[6].push_back(12);
  61.     gr[6].push_back(13);
  62.     gr[7].push_back(14);
  63.     gr[7].push_back(15);
  64.     dfs(1);
  65.     srand(time(0));
  66.     for (int i = 8; i <= 15; i += 2) {
  67.         jdi();
  68.         cout << S[i] << '*' << S[i + 1];
  69.         if (i != 14) {
  70.             cout << "||";
  71.         }
  72.     }
  73.     cout << endl;
  74.     //***********
  75.     for (int i = 1; i <= 12; i++) {
  76.         cout << ' ';
  77.     }
  78.     jdi();
  79.     cout << S[4] << '*' << S[5];
  80.     jdi();
  81.     cout << "||||" << S[6] << '*' << S[7] << endl;
  82.     jdi();
  83.     for (int i = 1; i <= 17; i++) {
  84.         cout << ' ';
  85.     }
  86.     cout << S[2] << "*" << S[3];
  87.     cout << endl;
  88.     jdi();
  89.     for (int i = 1; i <= 20; i++) {
  90.         cout << ' ';
  91.     }
  92.     cout << S[1];
  93.     cout << endl << endl;
  94.     system("pause");
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement