답안 #199089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199089 2020-01-29T07:52:38 Z virchau13 Timovi (COCI18_timovi) C++17
30 / 80
25 ms 3064 KB
#include <iostream>
#include <algorithm>
#include <set>
#include <deque>
#include <queue>
using namespace std;

int main(){
    long long n, k, m, r;
    cin >> n >> k >> m;
    long long arr[n];
    if(n <= 2){
        r = m / (n*k);
        m %= n*k;
        for(int i = 0; i < n; i++){
            arr[i] = (r*k) + min(m,k);
            m -= k;
            m = max(m, 0ll);
        }
        goto leave;
    }
    r = m / ((2*n-1)*k);
    m -= r*k;
    for(int i = 0; i < n; i++){
        arr[i] = (r*(i == 0 || i == n-1 ? k : 2*k) + min(m, k));
        m -= k;
        m = max(m, 0ll);
    }
    for(int i = n-2; i > 0; i--){
        arr[i] += min(m, k);
        m -= k;
        m = max(m, 0ll);
    }
leave:
    for(int i = 0; i < n; i++){
        cout << arr[i] << ' ';
    }
    cout << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Incorrect 6 ms 256 KB Output isn't correct
3 Correct 24 ms 2296 KB Output is correct
4 Correct 21 ms 2296 KB Output is correct
5 Incorrect 5 ms 376 KB Output isn't correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 23 ms 2936 KB Output isn't correct
8 Incorrect 25 ms 3064 KB Output isn't correct