Submission #1313333

#TimeUsernameProblemLanguageResultExecution timeMemory
1313333rojuslol1Rabbit Carrot (LMIO19_triusis)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; int main() { long long n, m; cin >> n >> m; vector<long long> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; h[i] = -(h[i] - (i + 1) * m); } vector<long long> tops; tops.push_back(0); for (int i = 0; i < n; i++) { if (tops.back() <= h[i]) { tops.push_back(h[i]); } else { auto it = upper_bound(tops.begin(), tops.end(), h[i]); *it = max(h[i], 0LL); } } cout << n - (long long)tops.size() + 1 << "\n"; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:23:23: error: 'upper_bound' was not declared in this scope
   23 |             auto it = upper_bound(tops.begin(), tops.end(), h[i]);
      |                       ^~~~~~~~~~~