Submission #964670

#TimeUsernameProblemLanguageResultExecution timeMemory
964670irmuunRabbit Carrot (LMIO19_triusis)C++17
100 / 100
85 ms5012 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ int n,m; cin>>n>>m; int a[n+5],b[n+5]; for(int i=1;i<=n;i++){ cin>>a[i]; b[i]=i*m-a[i]; } vector<int>v; for(int i=1;i<=n;i++){ if(b[i]<0) continue; if(v.empty()||v.back()<=b[i]){ v.pb(b[i]); } else{ int pos=upper_bound(all(v),b[i])-v.begin(); v[pos]=b[i]; } } cout<<n-v.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...