Submission #239769

# Submission time Handle Problem Language Result Execution time Memory
239769 2020-06-17T09:22:40 Z VEGAnn Timovi (COCI18_timovi) C++14
50 / 80
1000 ms 2168 KB
#include <bits/stdc++.h>
#define PB push_back
#define sz(x) ((int)x.size())
#define i3 array<int,3>
using namespace std;
typedef long double ld;
typedef long long ll;
const int N = 200100;
const int M = 510;
const int K = 110;
const int T = 2010;
const int oo = 2e9;
int ans[N], n, m, k;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> n >> k >> m;

    int loc = 0, ad = 1;

    while (m > 0){
        int ost = min(m, k);
        ans[loc] += ost;
        m -= ost;

        if (loc == n - 1 && ad == 1)
            ad = -1;

        if (loc == 0 & ad == -1)
            ad = 1;

        loc += ad;
    }

    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";

    return 0;
}

Compilation message

timovi.cpp: In function 'int main()':
timovi.cpp:34:17: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
         if (loc == 0 & ad == -1)
             ~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 20 ms 896 KB Output is correct
4 Correct 18 ms 768 KB Output is correct
5 Execution timed out 1092 ms 384 KB Time limit exceeded
6 Execution timed out 1092 ms 384 KB Time limit exceeded
7 Correct 959 ms 2168 KB Output is correct
8 Execution timed out 1081 ms 1152 KB Time limit exceeded