#include <bits/stdc++.h>
using namespace std;
int A[1000], B[1000], N, J, R, T;
int ceil(int x, int y){
return (x/y) + (x%y == 0 ? 0 : 1);
}
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> N >> J >> R >> T;
for (int i=0; i<N; i++){
A[i] = J;
}
for (int t=0; t<T; t++){
for (int i=0; i<N; i++) B[i] = 0;
for (int i=0; i<N-1; i++){
int num = ceil(A[i], R);
B[i] -= num;
B[i+1] += num;
}
for (int i=0; i<N; i++) A[i] += B[i];
}
for (int i=0; i<N; i++) cout << A[i] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
3 ms |
576 KB |
Output is correct |
7 |
Correct |
14 ms |
592 KB |
Output is correct |
8 |
Correct |
22 ms |
696 KB |
Output is correct |
9 |
Correct |
22 ms |
696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
3 ms |
576 KB |
Output is correct |
7 |
Correct |
14 ms |
592 KB |
Output is correct |
8 |
Correct |
22 ms |
696 KB |
Output is correct |
9 |
Correct |
22 ms |
696 KB |
Output is correct |
10 |
Runtime error |
3 ms |
780 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Halted |
0 ms |
0 KB |
- |