답안 #609432

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
609432 2022-07-27T15:38:32 Z alexz1205 Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int nums[n];
	for (int x = 0; x < n; x ++){
		int a;
		cin >> a;
		nums[x] = m * (x+1) - a;
	}
	vector<int> seq;
	seq.push_back(0);
	for (int x = 0; x < n; x ++){
		int i = lower_bound(seq.begin(), seq.end(), nums[x]) - seq.begin();
		if (i == seq.size()){
			seq.push_back(nums[x]);
		}else {
			seq[i] = nums[x];
		}
	}
	cout << n - seq.size() << endl;
	return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:19:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   if (i == seq.size()){
      |       ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -