답안 #1086925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1086925 2024-09-11T18:50:06 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
0 ms 432 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;

    vector<int> heights(n);
    for(int i= 0 ;i<n; i++){
        cin >> heights[i];
    }

    vector<int> difs(n);
    int count = 0;

    difs[0] = heights[0]-m;
    for(int i = 1; i<n; i++){
        difs[i] = heights[i]-heights[i-1]-m;
    }

    int spot = 0;
    while(difs[spot]>0){
        int makeup = difs[spot];
        count++;
        if(spot+1<n){
            difs[spot+1]+=makeup;
        }
        spot++;
    }
    
    while(spot<n){
        if(difs[spot]>0){
            count++;
        }
        spot++;
    }

    cout<<count;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 432 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 432 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 432 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 432 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -