답안 #476547

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
476547 2021-09-27T15:00:06 Z dsyz Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (1000005)
int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);
    ll N,M;
    cin>>N>>M;
    ll arr[N + 1];
    memset(arr,0,sizeof(arr));
    for(ll i = 1;i <= N;i++){
		cin>>arr[i];
	}
	ll sum = 0;
	for(ll i = 1;i <= N;i++){
		if(arr[i] > arr[i - 1] + M){
			arr[i] = arr[i - 1] + M;
			sum++;
		}else{
			if((i < N - 1 && arr[i] + M < arr[i + 1] && arr[i - 1] + M + M >= arr[i + 1]) ||
			(i < N - 2 && arr[i + 1] + M < arr[i + 2] && arr[i - 1] + M + M + M >= arr[i + 2])){
				arr[i] = arr[i - 1] + M + M;
				sum++;
			}
		}
	}
	cout<<sum<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -