Codeforces Round #737 (Div. 2) question b

Revision en5, by _WATerror_AK, 2021-08-09 23:34:22

question Link

int n,k;
	cin >> n >>k;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		   cin>>a[i];
	}
    int ans=1;
    for(int i=1;i<n;i++){
        if(a[i]>=a[i-1]){
            continue;
        }else{
            ans++;
        }
    }
    //deb(ans);
    if(ans<=k){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }

what's wrong with this code? I don't understand why it is giving the wrong answer.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English _WATerror_AK 2021-08-09 23:34:22 325
en4 English _WATerror_AK 2021-08-09 23:33:09 360
en3 English _WATerror_AK 2021-08-09 23:32:17 20
en2 English _WATerror_AK 2021-08-09 23:31:37 62
en1 English _WATerror_AK 2021-08-09 23:30:07 559 Initial revision (published)