| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 143038 | Azert | Timovi (COCI18_timovi) | C++14 | 21 ms | 2168 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;
const int N = 2e5 + 5;
int n, k, m;
int res[N];
int main() {
    scanf("%d%d%d", &n, &k, &m);
    int time = m / k;
    int cycle = time / (n - 1);
    for (int i = 2; i < n; i++) res[i] += k * cycle;
    res[1] += ((cycle + 1) / 2) * k;
    res[n] += (cycle / 2) * k;
    m -= cycle * (n - 1) * k;
    if (cycle % 2 == 1) {
        for (int i = n; m != 0; i--) {
            res[i] += min(k, m);
            m -= min(k, m);
        }
    }
    else {
        for (int i = 1; m != 0; i++) {
            res[i] += min(k, m);
            m -= min(k, m);
        }
    }
    for (int i = 1; i <= n; i++) printf("%d ", res[i]);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
