Submission #991698

#TimeUsernameProblemLanguageResultExecution timeMemory
991698SnowRaven52Rabbit Carrot (LMIO19_triusis)C++17
100 / 100
56 ms5400 KiB
#include <bits/stdc++.h> using namespace std; int main() { // freopen("main.in", "r", stdin); // freopen(".out", "w", stdout); int n, h; cin >> n >> h; vector<int> poles(n); for (int i = 0; i < n; i++) cin >> poles[i]; vector<int> same; for(int i = 1; i <= n; i++) if(i * h >= poles[i-1]) same.push_back(i * h - poles[i - 1]); vector<int> min_endings; for (auto i : same){ int pos = upper_bound(min_endings.begin(), min_endings.end(), i) - min_endings.begin(); if(pos == int(min_endings.size())) min_endings.push_back(i); else min_endings[pos] = i; } cout << n - int(min_endings.size()) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...