답안 #83327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83327 2018-11-06T23:47:48 Z josiftepe Timovi (COCI18_timovi) C++14
80 / 80
25 ms 4620 KB
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int maxn = 1e6 + 10;
ll n, k, m;
ll ret[maxn];
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
//    ifstream cin("in.txt");
    cin >> n >> k >> m;
    ll path_sz = 2 * n - 2;
    ll kids = path_sz * k;
    ll full = m / kids;
    ll rem_groups = (m % kids) / k;
    ll rem_children = (m % kids) % k;
    for(int i = 1; i <= path_sz; i ++){
        ret[i] = full * k;
    }
    for(int i = 1; i <= rem_groups; i ++){
        ret[i] += k;
    }
    ret[rem_groups + 1] += rem_children;
    cout << ret[1] << " ";
    for(int i = 2; i < n; i ++){
        ret[i] += ret[path_sz - i + 2];
        cout << ret[i] << " ";
    }
    cout << ret[n] << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 456 KB Output is correct
3 Correct 20 ms 4044 KB Output is correct
4 Correct 21 ms 4044 KB Output is correct
5 Correct 2 ms 4044 KB Output is correct
6 Correct 2 ms 4044 KB Output is correct
7 Correct 22 ms 4620 KB Output is correct
8 Correct 25 ms 4620 KB Output is correct