#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5*3;
int main()
{
int n, m;
cin>>n>>m;
int a[maxN];
for(int i = 1; i <= n; i++)cin>>a[i];
int uses=0;
int curH=0;
for(int i = 1; i <= n; i++){
if(curH+m>=a[i])curH=a[i];
else{ curH=curH+m;uses++;}
}
cout<<uses;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1356 KB |
Output is correct |
2 |
Correct |
1 ms |
1440 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1356 KB |
Output is correct |
5 |
Correct |
1 ms |
1464 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1468 KB |
Output is correct |
8 |
Correct |
1 ms |
1464 KB |
Output is correct |
9 |
Correct |
1 ms |
1460 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1356 KB |
Output is correct |
12 |
Incorrect |
1 ms |
1356 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1356 KB |
Output is correct |
2 |
Correct |
1 ms |
1440 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1356 KB |
Output is correct |
5 |
Correct |
1 ms |
1464 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1468 KB |
Output is correct |
8 |
Correct |
1 ms |
1464 KB |
Output is correct |
9 |
Correct |
1 ms |
1460 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1356 KB |
Output is correct |
12 |
Incorrect |
1 ms |
1356 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1356 KB |
Output is correct |
2 |
Correct |
1 ms |
1440 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1356 KB |
Output is correct |
5 |
Correct |
1 ms |
1464 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1468 KB |
Output is correct |
8 |
Correct |
1 ms |
1464 KB |
Output is correct |
9 |
Correct |
1 ms |
1460 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1356 KB |
Output is correct |
12 |
Incorrect |
1 ms |
1356 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1356 KB |
Output is correct |
2 |
Correct |
1 ms |
1440 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1356 KB |
Output is correct |
5 |
Correct |
1 ms |
1464 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1468 KB |
Output is correct |
8 |
Correct |
1 ms |
1464 KB |
Output is correct |
9 |
Correct |
1 ms |
1460 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1356 KB |
Output is correct |
12 |
Incorrect |
1 ms |
1356 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |