제출 #716565

#제출 시각아이디문제언어결과실행 시간메모리
716565studyRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5+1, M = 5001;

int a[N];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	for (int i=1; i<=n; ++i){
		cin >> a[i];
		a[i] = m*i-a[i];
	}
	vector<int> dp;
	for (int i=1; i<=n; ++i){
		if (a[i] < 0) continue;
		int pos = lower_bound(dp.begin(),dp.end(),a[i])-dp.begin();
		if (pos == dp.size()){
			dp.emplace_back(a[i]);
		}
		else{
			dp[pos] = min(dp[pos],a[i]);
		}
	}
	cout << n-dp.size() << '\n';
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

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