Submission #882132

# Submission time Handle Problem Language Result Execution time Memory
882132 2023-12-02T16:29:46 Z iag99 Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

const int MAX_SWAPS=465;
int lis = 0;
multiset<int> s;
int main() {
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	iostream::sync_with_stdio(false);
	cin.tie(0);
	/*
	 * 13 3 366 -43 11 -6 -20 20 4
	 */
	 int n,m;
	 cin>>n>>m;
	 vector<int> a(n);
	 for(int i=0; i<n; i++)
	 {
		 cin>>a[i];
	 }
	 vector<int> s;
	 for(int i=1; i<=n; i++)
	 {
		 if(i*m>=a[i-1])
		 {
			 s.push_back(i*m-a[i-1]);
		 }
	 }
	 vector<int> ans;
	 for(int x : a)
	 {
		 if(upper_bound(ans.begin(), ans.end(),x)==ans.end())
		 {
			 ans.push_back(x);
		 }
		 else
		 {
			 int in=upper_bound(ans.begin(), ans.end(),x)-ans.begin();
			 ans[in]=x;
		 }
	 }
	 cout<<n-ans.size()<<endl;
	 return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -