Submission #389838

#TimeUsernameProblemLanguageResultExecution timeMemory
389838SirCovidThe19thRabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	
	//poles, max leap
	int n, m;
	cin >> n >> m;
	vector<int> seq;
	for (int i = 1; i <= n; i++){
		int a;
		cin >> a;
        //if (i*m >= a)
		    seq.push_back(m*i-a);
	}
	multiset<int> dp;
    for (int i = 0; i < seq.size(); i++){
        auto pos = dp.upper_bound(seq[i]);			
        dp.insert(seq[i]);
        if (pos != dp.end())
            dp.erase(pos);
    }
    cout<<n-dp.size();
}

Compilation message (stderr)

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