Submission #63314

#TimeUsernameProblemLanguageResultExecution timeMemory
63314MAMBATimovi (COCI18_timovi)C++14
80 / 80
32 ms3240 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define $ system("pause") #define MOD (ll)10139 #define MAXN 200010 template<typename T> inline T smin(T &a, const T &b) { return a > b ? a = b : a; } template<typename T> inline T smax(T &a, const T &b) { return a < b ? a = b : a; } inline void add(ll &l, const ll &r) { l = (l + r) % MOD; } ll gcd(ll v, ll u) { return u ? gcd(u, v % u) : v; } ll po(ll v, ll u) { return u ? (po(v * v % MOD, u >> 1) * (u & 1 ? v : 1) % MOD) : 1; } ll n, m, k; ll answer[MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> m; ll local = m / k; ll local2 = local / (n - 1); for (int i = 1; i < n; i++) { answer[i] += k * ((local2 + 1) / 2); } for (int i = 2; i <= n; i++) { answer[i] += k * (local2 / 2); } m -= local2 * (n - 1) * k; if (local2 & 1) { for (int i = n; m; i--) { answer[i] += min(k, m); m -= min(m, k); } } else { for (int i = 1; m; i++) { answer[i] += min(k, m); m -= min(m, k); } } for (int i = 1; i <= n; i++) cout << answer[i] << ' '; //$; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...