제출 #739769

#제출 시각아이디문제언어결과실행 시간메모리
739769Dead_Inside7Rabbit Carrot (LMIO19_triusis)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int lis(vector<int>&b){
	vector<int> dp;
	for(auto it:b){
		int x = upper_bound(dp.begin(),dp.end(),it) -  dp.begin();
		if(x==dp.size()) dp.push_back(it);
		else dp[x]=it;
	}
	return dp.size();
}
int main() {
	int n,k;cin>>n>>k;
	vector<int> arr(n);
	for(auto&v:arr) cin>>v;
    vector<int> b(n);
    for(int j=1;j<=n;j++){
    	b[j-1] = ((k*j) - a[j-1]);
    }
    cout<<n-lis(b)<<endl;
	return 0;
}

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

triusis.cpp: In function 'int lis(std::vector<int>&)':
triusis.cpp:7:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   if(x==dp.size()) dp.push_back(it);
      |      ~^~~~~~~~~~~
triusis.cpp: In function 'int main()':
triusis.cpp:18:24: error: 'a' was not declared in this scope
   18 |      b[j-1] = ((k*j) - a[j-1]);
      |                        ^