This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
#define endl '\n'
#define trav(var, begin, end) for(auto var = begin; var < end; ++var)
#define travi(var, begin, end) for(auto var = begin-1; var >= end; --var)
#define travd(var, begin, end, delta) for(auto var = begin; var < end; var += delta)
#define travdi(var, begin, end, delta) for(auto var = begin-1; var >= end; var -= delta)
#pragma GCC optimize ("Ofast")
using namespace std;
using ld = long double;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;
using ushort = unsigned short;
using uchar = unsigned char;
const int inf = 987654321;
const int bigprime = int(2e9 + 11);
const ld pi = acosl(-1);
const double eps = 1e-12;
const int dirs[4][2] = { { 1, 0 },{ 0, 1 },{ -1, 0 },{ 0, -1 } };
int main()
{
cin.sync_with_stdio(false), cin.tie(nullptr);
cout << fixed << setprecision(10);
ll n, j, r, t;
cin >> n >> j >> r >> t;
ll arr[100000];
trav(i, 0, n)
arr[i] = j;
int top = 0;
//int bottom = 0;
trav(i, 0, t)
{
arr[n - 1] += arr[n - 2] / r + !!(arr[n - 2] % r);
travi(k, n - 1, top + 1)
arr[k] = arr[k - 1] / r + !!(arr[k - 1] % r) + arr[k] * (r - 1) / r;
arr[top] = arr[top] * (r - 1) / r;
if (!arr[top])
top++;
if (top >= n)
break;
}
trav(i, 0, n)
cout << arr[i] << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |