Submission #1216212

#TimeUsernameProblemLanguageResultExecution timeMemory
1216212edwardh101Rabbit Carrot (LMIO19_triusis)C++20
100 / 100
17 ms2496 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; using int64 = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; int64 m; if (!(cin >> n >> m)) return 0; vector<int64> t; for (int i = 1; i <= n; ++i) { int64 h; cin >> h; int64 v = 1LL * i * m - h; if (v < 0) continue; auto it = upper_bound(t.begin(), t.end(), v); if (it == t.end()) t.push_back(v); else *it = v; } cout << n - t.size() << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...