Submission #403929

#TimeUsernameProblemLanguageResultExecution timeMemory
403929RyednapRabbit Carrot (LMIO19_triusis)C++14
100 / 100
36 ms3804 KiB
#include "bits/stdc++.h"

using namespace std;

#ifdef LOCAL
#include "uj.h"
#endif

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	vector<long long> dp;
	
	for(int i = 1; i <= n; ++i) {
		long long x; scanf("%lld", &x);
		x = i * (long long)m - x;
		if(x < 0) continue;
		if(dp.empty() || x >= dp.back()) {
			dp.push_back(x);
		} else {
			*upper_bound(dp.begin(), dp.end(), x) = x;
		}
	}
	
	printf("%d\n", n - (int)dp.size());
    return 0;
}

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d %d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~
triusis.cpp:15:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   long long x; scanf("%lld", &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...