Submission #482493

# Submission time Handle Problem Language Result Execution time Memory
482493 2021-10-25T00:48:47 Z Deepesson Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
0 ms 204 KB
#include <bits/stdc++.h>

int main()
{
    int N,M;
    std::cin>>N>>M;
    std::vector<int> vec;
    int alturas[N];
    for(int i=0;i!=N;++i){
        int h;
        std::cin>>h;
        alturas[i]=h;
        vec.push_back(h-(M*i));
    }
    std::reverse(vec.begin(),vec.end());
    std::vector<int> veco;
    for(int i=0;i!=N;++i){
        if(((N-i)-1)*M<alturas[i])continue;
        int x = vec[i];
        auto it = std::upper_bound(veco.begin(),veco.end(),x);
        if(it!=veco.end()){
            *it=x;
        }else veco.push_back(x);
    }
    std::cout<<(N-veco.size())<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -