Submission #521751

#TimeUsernameProblemLanguageResultExecution timeMemory
521751penguin133Rabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; int dp[200005], A[200005]; int main(){ int n,m, maxi =0 ;cin >> n >> m; for(int i=1;i<=n;i++)cin >> A[i], A[i] = m * i - A[i]; vector<int>v; vector<int> :: iterator it; for(int i=1;i<=n;i++){ if(A[i] < 0)continue; if(v.empty() || A[i] >= v.back())v.push_back(A[i]); else it = lower_bound(v.begin(), v.end() , A[i]), *it = A[i]; } cout << n-v.size(); }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:7:11: warning: unused variable 'maxi' [-Wunused-variable]
    7 |  int n,m, maxi =0 ;cin >> n >> m;
      |           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...