# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
240105 | MrRobot_28 | Timovi (COCI18_timovi) | C++17 | 23 ms | 2304 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;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k, m;
cin >> n >> k >> m;
vector <int> a(n);
a[0] += min(m, k);
m -= min(m, k);
int c = m / ((n - 1) * k);
for(int i = 0; i < n; i++)
{
if(i == 0)
{
a[i] += (c / 2) * k;
}
else if(i == n - 1)
{
a[i] += ((c + 1) / 2) * k;
}
else
{
a[i] += k * c;
}
}
m -= c * (n - 1) * k;
if(c % 2 == 0)
{
for(int i = 1; i < n; i++)
{
a[i] += min(m, k);
m -= min(m, k);
}
}
else
{
for(int i = n - 2; i >= 0; i--){
a[i] += min(m, k);
m -= min(m, k);
}
}
for(int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |