Submission #1166842

#TimeUsernameProblemLanguageResultExecution timeMemory
1166842ChocoRabbit Carrot (LMIO19_triusis)C++20
100 / 100
17 ms6632 KiB
#include<bits/stdc++.h> using namespace std; #define Study ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define ll long long #define ull unsigned long long #define pb push_back #define ff first #define ss second #define ins insert #define all(x) x.begin(),x.end() #define fori(x,y,z) for(ll x=y;x<=z;x++) const ll INF=1e18; const ll sz=5e4+10; const ll mod=1e9+7; void work(){ ll n,m; cin>>n>>m; vector<ll>v(n+10,0); fori(i,1,n){ cin>>v[i]; } vector<ll>maxleft; fori(i,1,n){ if(i*m>=v[i]){ maxleft.pb(i*m-v[i]); } } vector<ll>wedontchange; for(auto x : maxleft){ ll cr=(upper_bound(all(wedontchange),x))-wedontchange.begin(); if(cr==wedontchange.size()) wedontchange.pb(x); else wedontchange[cr]=x; } cout<<n-wedontchange.size()<<endl; } int main(){ Study; ll t=1; //cin>>t; while(t--){ work(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...