# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475049 | rainboy | Timovi (COCI18_timovi) | C11 | 20 ms | 2124 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 <stdio.h>
#define N 200000
int main() {
static int aa[N];
int n, k, m, r, i;
scanf("%d%d%d", &n, &k, &m);
r = m / (n - 1) / 2 / k;
for (i = 0; i < n; i++)
aa[i] = r * k * (i == 0 || i == n - 1 ? 1 : 2);
m -= r * (n - 1) * 2 * k;
for (i = 0; i < n - 1; i++)
if (m >= k)
aa[i] += k, m -= k;
else {
aa[i] += m, m = 0;
break;
}
for (i = n - 1; i > 0; i--)
if (m >= k)
aa[i] += k, m -= k;
else {
aa[i] += m, m = 0;
break;
}
for (i = 0; i < n; i++)
printf("%d ", aa[i]);
printf("\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |