#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <math.h>
#include <memory.h>
using namespace std;
#define MAX_SIZE 100
#define InF 0x7fffffff
#define CEnDL "\n"
#define ll long long
int main() {
cin.tie(0);
std::ios::sync_with_stdio(false);
int n; cin >> n; // can area
int j; cin >> j; // count of jelly;
int r; cin >> r; // after bunpo
int second; // time;
cin >> second;
vector<int> arr(n);
for (int i = 0; i < n; i++)
arr[i] = j;
while (second--) {
vector<int> brr(n);
for (int i = 0; i < n-1; i++) {
int cand = arr[i];
int remain = ceil((float)cand / r);
if(arr[i] > 0)
arr[i] -= remain;
brr[i+1] = remain;
}
for (int i = 0; i < n - 1; i++) {
arr[i+1] += brr[i + 1];
}
}
for (int i = 0; i < n; i++) {
cout << arr[i] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
356 KB |
Output is correct |
3 |
Correct |
2 ms |
432 KB |
Output is correct |
4 |
Correct |
2 ms |
432 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
4 ms |
540 KB |
Output is correct |
7 |
Correct |
18 ms |
540 KB |
Output is correct |
8 |
Correct |
25 ms |
744 KB |
Output is correct |
9 |
Correct |
26 ms |
744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
356 KB |
Output is correct |
3 |
Correct |
2 ms |
432 KB |
Output is correct |
4 |
Correct |
2 ms |
432 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
4 ms |
540 KB |
Output is correct |
7 |
Correct |
18 ms |
540 KB |
Output is correct |
8 |
Correct |
25 ms |
744 KB |
Output is correct |
9 |
Correct |
26 ms |
744 KB |
Output is correct |
10 |
Execution timed out |
2069 ms |
744 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |