# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143038 | 2019-08-12T16:43:18 Z | Azert | Timovi (COCI18_timovi) | C++14 | 21 ms | 2168 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 20 ms | 1528 KB | Output is correct |
4 | Correct | 18 ms | 1528 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 21 ms | 2168 KB | Output is correct |
8 | Correct | 21 ms | 2168 KB | Output is correct |