KarleFKremen

Untitled

May 25th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.01 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define FILE ""
  6. #define FILEIO 0
  7. #define LONG 0
  8. #define IOSOPT 0
  9.  
  10. #if LONG
  11.     typedef long long ll;
  12.     typedef unsigned long long ull;
  13. #else // LONG
  14.     typedef int ll;
  15.     typedef unsigned int ull;
  16. #endif
  17. typedef short sym;
  18. #define pb push_back
  19. #define mp make_pair
  20. #define p(a, b) pair < a, b >
  21. #define rev(a) reverse(a.begin(), a.end())
  22. #define ord(a) sort(a.begin(), a.end())
  23. #define rm erase
  24. #define rs resize
  25. #define sz size
  26. #define fi first
  27. #define se second
  28. #define ins insert
  29. #define die(a) \
  30.     { \
  31.         cout << a << endl; \
  32.         exit(0); \
  33.     }
  34. #define stlprint(a) \
  35.     for(auto _STL_ITER = a.begin(); _STL_ITER != a.end(); _STL_ITER++) \
  36.     { \
  37.         cout << (*_STL_ITER) << ' '; \
  38.     }
  39.  
  40. ll aryph(ll a0, ll n, ll k = 1)
  41. {
  42.     ll an = a0 + k * (n - 1);
  43.     return (((a0 + an) * n) / 2);
  44. }
  45.  
  46. main()
  47. {
  48.     #if IOSOPT
  49.         ios_base::sync_with_stdio(0);
  50.         cin.tie(0);
  51.     #endif // IOSOPT
  52.     #if FILEIO
  53.         freopen(FILE".in", "r", stdin);
  54.         freopen(FILE".out", "w", stdout);
  55.     #endif
  56.     ll n, t;
  57.     cin >> n >> t;
  58.     vector < vector < ll > > a;
  59.     a.rs(n);
  60.     for(int i = 0; i < n; i++)    
  61.     {
  62.         a[i].rs(i + 1);
  63.     }
  64.     ll two = 1 << 10;
  65.     for(int time = 0; time < t; time++)
  66.     {
  67.         a[0][0] += two;
  68.         if(a[0][0] > two)
  69.         {
  70.             a[1][0] += (two / 2);
  71.             a[1][1] += (two / 2);
  72.             a[0][0] = two;
  73.         }
  74.         for(int i = 1; i < (n - 1); i++)
  75.         {
  76.             for(int j = 0; j < a[i].sz(); j++)
  77.             {
  78.                 if(a[i][j] > two)
  79.                 {
  80.                     a[i + 1][j] += (a[i][j] - two) / 2;
  81.                     a[i + 1][j + 1] += (a[i][j] - two) / 2;
  82.                     a[i][j] = two;
  83.                 }
  84.             }
  85.         }
  86.     }
  87.     ll cnt = 0;
  88.     for(int i = 0; i < n; i++)
  89.         for(int j = 0; j < a[i].sz(); j++)
  90.             cnt += (a[i][j] >= two);
  91.     cout << cnt << endl;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment