Submission #251986

#TimeUsernameProblemLanguageResultExecution timeMemory
251986_ypcRabbit Carrot (LMIO19_triusis)C++98
100 / 100
132 ms3952 KiB
#include <bits/stdc++.h> typedef long long LL; using namespace std; int n,k; vector <LL> mou; int main(){ cin>>n>>k; mou.push_back(0); for (int i=1;i<=n;i++){ int h;cin>>h; LL v=k*i-h; if (v<0)continue; int fin=upper_bound(mou.begin(),mou.end(),v)-mou.begin(); if (fin==mou.size())mou.push_back(v); else mou[fin]=v; } cout<<n-mou.size()+1<<endl; return 0; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:14:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (fin==mou.size())mou.push_back(v); else mou[fin]=v;
             ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...