# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98244 | dalgerok | Timovi (COCI18_timovi) | C++17 | 29 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 int long long
using namespace std;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n, k, m;
cin >> n >> k >> m;
int a[n + 1];
memset(a, 0, sizeof(a));
for(int i = 1; i <= n; i++){
a[i] = (m >= k ? k : m);
m -= (m >= k ? k : m);
}
int val = m / ((n - 1) * k);
m %= ((n - 1) * k);
for(int i = 1; i < n; i++){
a[i] += ((val + 1) / 2) * k;
}
for(int i = n; i > 1; i--){
a[i] += (val / 2) * k;
}
if(val % 2 == 0){
for(int i = 2; i <= n; i++){
a[i] += (m >= k ? k : m);
m -= (m >= k ? k : m);
}
}
else{
for(int i = n - 1; i >= 1; i--){
a[i] += (m >= k ? k : m);
m -= (m >= k ? k : m);
}
}
for(int i = 1; i <= n; i++){
cout << a[i] << " ";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |