/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 484.0 KiB
#2 Accepted 2ms 492.0 KiB
#3 Accepted 3ms 512.0 KiB
#4 Accepted 2ms 560.0 KiB
#5 Accepted 2ms 460.0 KiB
#6 Accepted 2ms 480.0 KiB
#7 Accepted 2ms 332.0 KiB
#8 Accepted 2ms 484.0 KiB
#9 Accepted 2ms 332.0 KiB
#10 Wrong Answer 2ms 512.0 KiB
#11 Accepted 2ms 508.0 KiB
#12 Accepted 2ms 332.0 KiB
#13 Accepted 2ms 340.0 KiB
#14 Accepted 2ms 328.0 KiB
#15 Accepted 2ms 492.0 KiB
#16 Accepted 2ms 328.0 KiB
#17 Accepted 2ms 544.0 KiB
#18 Accepted 2ms 332.0 KiB
#19 Accepted 2ms 328.0 KiB
#20 Accepted 2ms 484.0 KiB
#21 Accepted 8ms 800.0 KiB
#22 Accepted 142ms 6.695 MiB
#23 Accepted 139ms 7.422 MiB
#24 Accepted 175ms 9.344 MiB
#25 Accepted 333ms 13.734 MiB
#26 Accepted 106ms 7.055 MiB
#27 Accepted 17ms 1.496 MiB
#28 Accepted 145ms 7.398 MiB
#29 Accepted 153ms 8.355 MiB
#30 Accepted 198ms 13.852 MiB
#31 Accepted 229ms 10.832 MiB
#32 Accepted 228ms 14.699 MiB
#33 Accepted 157ms 11.953 MiB
#34 Accepted 187ms 9.336 MiB
#35 Accepted 225ms 15.617 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-11 02:32:05
Judged By
Score
97
Total Time
333ms
Peak Memory
15.617 MiB