Submission #199091

# Submission time Handle Problem Language Result Execution time Memory
199091 2020-01-29T08:12:56 Z smjleo Timovi (COCI18_timovi) C++14
30 / 80
25 ms 2936 KB
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion
const int N = 200005;

ll n, k, m, ans[N], onecycle, ncycle, rem;

pls give {
    AC;
    cin >> n >> k >> m;
    onecycle = (2*n-2)*k;
    ncycle = m / onecycle;
    rem = m % onecycle;
    // cout << onecycle << ' ' << ncycle << endl;
    for (int i=0; i<n; i++) {
        ans[i] = ncycle * k;
        if (rem > k) {
            ans[i] += k;
            rem -= k;
        } else {
            ans[i] += rem;
            rem = 0;
        }
    }
    for (int i=n-2; i>=0; i--) {
        if (rem > k) {
            ans[i] += k;
            rem -= k;
        } else {
            ans[i] += rem;
            rem = 0;
            break;
        }
    }
    for (int i=0; i<n; i++) cout << ans[i] << ' ';
}

Compilation message

timovi.cpp:1:0: warning: ignoring #pragma region cp [-Wunknown-pragmas]
 #pragma region cp-helper
 
timovi.cpp:30:0: warning: ignoring #pragma endregion  [-Wunknown-pragmas]
 #pragma endregion
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Correct 22 ms 2296 KB Output is correct
4 Correct 19 ms 2296 KB Output is correct
5 Incorrect 5 ms 376 KB Output isn't correct
6 Correct 5 ms 380 KB Output is correct
7 Incorrect 25 ms 2936 KB Output isn't correct
8 Incorrect 23 ms 2936 KB Output isn't correct