# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591198 | starchan | Timovi (COCI18_timovi) | C++17 | 15 ms | 3680 KiB |
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>
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
vector<int> a(MX, 0);
int n, m, k;
void dewit(int i, int change)
{
if(m < k)
{
a[i]+=m;
return;
}
m-=k;
a[i]+=k;
if(i+change < 1 || i+change > n)
change*=(-1);
dewit(i+change, change);
return;
}
signed main()
{
fast();
cin >> n >> k >> m;
int period = 2*(n-1)*k;
int times = m/period;
m%=period;
a[1] = times*k;
for(int i = 2; i < n; i++)
a[i] = 2*times*k;
a[n] = times*k;
dewit(1, +1);
for(int i = 1; i <= n; i++)
cout << a[i] << " ";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |