제출 #240105

#제출 시각아이디문제언어결과실행 시간메모리
240105MrRobot_28Timovi (COCI18_timovi)C++17
80 / 80
23 ms2304 KiB
#include <bits/stdc++.h> using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k, m; cin >> n >> k >> m; vector <int> a(n); a[0] += min(m, k); m -= min(m, k); int c = m / ((n - 1) * k); for(int i = 0; i < n; i++) { if(i == 0) { a[i] += (c / 2) * k; } else if(i == n - 1) { a[i] += ((c + 1) / 2) * k; } else { a[i] += k * c; } } m -= c * (n - 1) * k; if(c % 2 == 0) { for(int i = 1; i < n; i++) { a[i] += min(m, k); m -= min(m, k); } } else { for(int i = n - 2; i >= 0; i--){ a[i] += min(m, k); m -= min(m, k); } } for(int i = 0; i < n; i++) { cout << a[i] << " "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...