Advertisement
deushiro

Untitled

Feb 10th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <string>
  6. #include <set>
  7. #include <map>
  8. #include <list>
  9. #include <time.h>
  10. #include <math.h>
  11. #include <random>
  12. #include <deque>
  13. #include <queue>
  14. #include <cassert>
  15. #include <unordered_map>
  16. #include <unordered_set>
  17. #include <iomanip>
  18. #include <bitset>
  19. #include <sstream>
  20. #include <chrono>
  21. #include <cstring>
  22.  
  23. using namespace std;
  24.  
  25. typedef long long ll;
  26.  
  27. int main()
  28. {
  29.     int t1 = 0, t2 = 0;
  30.     vector<int> a(420, 1);
  31.     vector<vector<int>> q(10000, vector<int>());
  32.     bool found = false;
  33.     int ans = 0;
  34.     for (int i = 0; i < 100; ++i) {
  35.         q[t1].push_back(0);
  36.         t1 += 15;
  37.     }
  38.     for (int i = 0; i < 100; ++i) {
  39.         q[t2].push_back(1);
  40.         t2 += 8;
  41.     }
  42.     cout << endl;
  43.     for (int i = 0; i < 1000 && !found; ++i) {
  44.         for (int j = 0; j < 420; ++j) {
  45.             a[j]--;
  46.             if (a[j] < 0)
  47.                 a[j] = 0;
  48.         }
  49.         if (q[i].size() > 0) {
  50.             bool x1 = false;
  51.             bool check = false;
  52.             for (int u : q[i]) {
  53.                 if (u == 0) {
  54.                     x1 = true;
  55.                     ++ans;
  56.                     for (int j = 0; j < 420; ++j) {
  57.                         bool flag = true;
  58.                         if (a[j] <= 0) {
  59.                             for (int k = 0; k < 80; ++k) {
  60.                                 if (k + j >= 420 || a[j + k] > 0)
  61.                                     flag = false;
  62.                             }
  63.                         }
  64.                         else
  65.                             flag = false;
  66.                         if (flag) {
  67.                             check = true;
  68.                             for (int k = 0; k < 80; ++k) {
  69.                                 a[j + k] = 42;
  70.                             }
  71.                             break;
  72.                         }
  73.                     }
  74.                 }
  75.                 else {
  76.                     for (int j = 0; j < 420; ++j) {
  77.                         bool flag = true;
  78.                         if (a[j] <= 0) {
  79.                             for (int k = 0; k < 40; ++k) {
  80.                                 if (k + j >= 420 || a[j + k] > 0)
  81.                                     flag = false;
  82.                             }
  83.                         }
  84.                         else
  85.                             flag = false;
  86.                         if (flag) {
  87.                             for (int k = 0; k < 40; ++k) {
  88.                                 a[j + k] = 21;
  89.                             }
  90.                             break;
  91.                         }
  92.                     }
  93.                 }
  94.             }
  95.             if (x1 && !check) {
  96.                 cout << ans << endl;
  97.                 found = true;
  98.             }
  99.         }
  100.     }
  101.    
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement