Submission #98244

# Submission time Handle Problem Language Result Execution time Memory
98244 2019-02-21T16:20:41 Z dalgerok Timovi (COCI18_timovi) C++17
30 / 80
29 ms 2936 KB
#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
1 Incorrect 2 ms 384 KB Output isn't correct
2 Correct 3 ms 424 KB Output is correct
3 Correct 21 ms 2424 KB Output is correct
4 Correct 17 ms 2304 KB Output is correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 29 ms 2936 KB Output isn't correct
8 Incorrect 18 ms 2916 KB Output isn't correct