Submission #700222

#TimeUsernameProblemLanguageResultExecution timeMemory
700222LucasLeRabbit Carrot (LMIO19_triusis)C++17
100 / 100
79 ms6836 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int main() { ll N, M; cin >> N >> M; vector<ll> b; for (ll i = 1; i <= N; ++i) { ll x; cin >> x; if (x <= M * i) { b.push_back(M * i - x); } } vector<ll> lis; for (ll x : b) { ll pos = upper_bound(lis.begin(), lis.end(), x) - lis.begin(); if (pos == lis.size()) lis.push_back(x); else lis[pos] = x; } cout << N - lis.size(); }

Compilation message (stderr)

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