Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll n,k;
cin>>n>>k;
vector<ll>v(n),p;
map<ll,ll>mp;
for(int i=0;i<n;i++)
{
cin>>v[i];
mp[v[i]]=i;
}
p=v;
sort(p.begin(),p.end());
ll c=0;
ll mn,mx=0;
for(int i=0;i<n;i++)
{
if(p[i]!=v[i])
{
c++;
if(c==1)
mn=i+1;
mx=i+1;
}
}
if(c<=k)
{
cout<<"YES\n";
cout<<mn<<" "<<mx<<endl;
}
else
cout<<"NO\n";
}
Information
- Submit By
- Type
- Submission
- Problem
- P1120 Stairway to the Skyline
- Contest
- Brain Booster #7
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-11-05 14:55:55
- Judged At
- 2024-11-11 02:32:05
- Judged By
- Score
- 97
- Total Time
- 333ms
- Peak Memory
- 15.617 MiB