/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 2ms 600.0 KiB
#4 Accepted 1ms 720.0 KiB
#5 Accepted 2ms 556.0 KiB
#6 Accepted 1ms 540.0 KiB
#7 Accepted 1ms 540.0 KiB
#8 Accepted 1ms 540.0 KiB
#9 Accepted 2ms 556.0 KiB
#10 Wrong Answer 1ms 540.0 KiB
#11 Accepted 1ms 540.0 KiB
#12 Accepted 2ms 340.0 KiB
#13 Accepted 1ms 540.0 KiB
#14 Accepted 2ms 512.0 KiB
#15 Accepted 2ms 540.0 KiB
#16 Accepted 1ms 540.0 KiB
#17 Accepted 1ms 796.0 KiB
#18 Accepted 2ms 516.0 KiB
#19 Accepted 2ms 492.0 KiB
#20 Accepted 1ms 540.0 KiB
#21 Accepted 5ms 796.0 KiB
#22 Accepted 74ms 6.52 MiB
#23 Accepted 89ms 7.539 MiB
#24 Accepted 88ms 9.352 MiB
#25 Accepted 184ms 13.543 MiB
#26 Accepted 60ms 6.938 MiB
#27 Accepted 11ms 1.52 MiB
#28 Accepted 99ms 7.598 MiB
#29 Accepted 92ms 8.219 MiB
#30 Accepted 125ms 14.02 MiB
#31 Accepted 132ms 10.727 MiB
#32 Accepted 141ms 14.68 MiB
#33 Accepted 106ms 11.957 MiB
#34 Accepted 111ms 9.57 MiB
#35 Accepted 151ms 15.73 MiB

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-05 14:55:55
Judged By
Score
97
Total Time
184ms
Peak Memory
15.73 MiB