Submission #239769

#TimeUsernameProblemLanguageResultExecution timeMemory
239769VEGAnnTimovi (COCI18_timovi)C++14
50 / 80
1092 ms2168 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...