Submission #239798

#TimeUsernameProblemLanguageResultExecution timeMemory
239798VEGAnnTimovi (COCI18_timovi)C++14
80 / 80
23 ms2936 KiB
#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 timeMemoryGrader output
Fetching results...