Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define FILE ""
- #define FILEIO 0
- #define LONG 0
- #define IOSOPT 0
- #if LONG
- typedef long long ll;
- typedef unsigned long long ull;
- #else // LONG
- typedef int ll;
- typedef unsigned int ull;
- #endif
- typedef short sym;
- #define pb push_back
- #define mp make_pair
- #define p(a, b) pair < a, b >
- #define rev(a) reverse(a.begin(), a.end())
- #define ord(a) sort(a.begin(), a.end())
- #define rm erase
- #define rs resize
- #define sz size
- #define fi first
- #define se second
- #define ins insert
- #define die(a) \
- { \
- cout << a << endl; \
- exit(0); \
- }
- #define stlprint(a) \
- for(auto _STL_ITER = a.begin(); _STL_ITER != a.end(); _STL_ITER++) \
- { \
- cout << (*_STL_ITER) << ' '; \
- }
- ll aryph(ll a0, ll n, ll k = 1)
- {
- ll an = a0 + k * (n - 1);
- return (((a0 + an) * n) / 2);
- }
- main()
- {
- #if IOSOPT
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- #endif // IOSOPT
- #if FILEIO
- freopen(FILE".in", "r", stdin);
- freopen(FILE".out", "w", stdout);
- #endif
- ll n, t;
- cin >> n >> t;
- vector < vector < ll > > a;
- a.rs(n);
- for(int i = 0; i < n; i++)
- {
- a[i].rs(i + 1);
- }
- ll two = 1 << 10;
- for(int time = 0; time < t; time++)
- {
- a[0][0] += two;
- if(a[0][0] > two)
- {
- a[1][0] += (two / 2);
- a[1][1] += (two / 2);
- a[0][0] = two;
- }
- for(int i = 1; i < (n - 1); i++)
- {
- for(int j = 0; j < a[i].sz(); j++)
- {
- if(a[i][j] > two)
- {
- a[i + 1][j] += (a[i][j] - two) / 2;
- a[i + 1][j + 1] += (a[i][j] - two) / 2;
- a[i][j] = two;
- }
- }
- }
- }
- ll cnt = 0;
- for(int i = 0; i < n; i++)
- for(int j = 0; j < a[i].sz(); j++)
- cnt += (a[i][j] >= two);
- cout << cnt << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment