Submission #239715

# Submission time Handle Problem Language Result Execution time Memory
239715 2020-06-17T08:09:10 Z VEGAnn Timovi (COCI18_timovi) C++14
30 / 80
22 ms 3072 KB
#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;

    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
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Correct 21 ms 2304 KB Output is correct
4 Correct 21 ms 2304 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Incorrect 4 ms 384 KB Output isn't correct
7 Incorrect 22 ms 2944 KB Output isn't correct
8 Incorrect 22 ms 3072 KB Output isn't correct