| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 239798 | VEGAnn | Timovi (COCI18_timovi) | C++14 | 23 ms | 2936 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>
#define PB push_back
#define sz(x) ((int)x.size())
using namespace std;
typedef long double ld;
typedef long long ll;
const int N = 200100;
const int M = 110;
const int K = 110;
const int MX = 210;
const int oo = 2e9;
ll n, k, m, ans[N];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL
    cin >> n >> k >> m;
    ll val = m / ((n - 1) * k);
    for (int i = 1; i < n - 1; i++)
        ans[i] = val * k;
    ans[n - 1] = (val / 2) * k;
    ans[0] = (val - ans[n - 1] / k) * k;
    m %= (n - 1) * k;
    if (val & 1){
        for (int i = n - 1; i >= 0 && m >= 0; i--){
            ll ost = min(m, k);
            ans[i] += ost;
            m -= ost;
        }
    } else {
        for (int i = 0; i < n && m >= 0; i++){
            ll ost = min(m, k);
            ans[i] += ost;
            m -= ost;
        }
    }
    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
