Submission #143038

#TimeUsernameProblemLanguageResultExecution timeMemory
143038AzertTimovi (COCI18_timovi)C++14
80 / 80
21 ms2168 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, k, m; int res[N]; int main() { scanf("%d%d%d", &n, &k, &m); int time = m / k; int cycle = time / (n - 1); for (int i = 2; i < n; i++) res[i] += k * cycle; res[1] += ((cycle + 1) / 2) * k; res[n] += (cycle / 2) * k; m -= cycle * (n - 1) * k; if (cycle % 2 == 1) { for (int i = n; m != 0; i--) { res[i] += min(k, m); m -= min(k, m); } } else { for (int i = 1; m != 0; i++) { res[i] += min(k, m); m -= min(k, m); } } for (int i = 1; i <= n; i++) printf("%d ", res[i]); }

Compilation message (stderr)

timovi.cpp: In function 'int main()':
timovi.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...