Submission #911087

#TimeUsernameProblemLanguageResultExecution timeMemory
911087KactusJackRabbit Carrot (LMIO19_triusis)C++14
100 / 100
24 ms5908 KiB
#include<bits/stdc++.h> #define ll long long #define F first #define S second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, m; cin >> n >> m; vector<ll> h(n+1); for(ll i = 1; i <= n; i++){ cin >> h[i]; h[i] -= m * i; h[i] *= -1; } vector<ll> dp; for(int i = 1; i <= n; i++){ if(h[i] < 0){ continue; } int j = upper_bound(dp.begin(), dp.end(), h[i]) - dp.begin(); if(j == dp.size()){ dp.push_back(h[i]); } else{ dp[j] = h[i]; } } cout << n - dp.size() << "\n"; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:24:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         if(j == dp.size()){
      |            ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...