/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 8ms 7.383 MiB
#2 Accepted 8ms 7.242 MiB
#3 Accepted 7ms 7.336 MiB
#4 Accepted 8ms 7.312 MiB
#5 Accepted 7ms 7.18 MiB
#6 Accepted 7ms 7.316 MiB
#7 Accepted 7ms 7.301 MiB
#8 Accepted 7ms 7.281 MiB
#9 Accepted 7ms 7.293 MiB
#10 Accepted 7ms 7.234 MiB
#11 Accepted 7ms 7.395 MiB
#12 Accepted 7ms 7.18 MiB
#13 Accepted 7ms 7.316 MiB
#14 Accepted 7ms 7.41 MiB
#15 Accepted 8ms 7.418 MiB
#16 Accepted 8ms 7.359 MiB
#17 Accepted 7ms 7.254 MiB
#18 Accepted 7ms 7.18 MiB
#19 Accepted 7ms 7.336 MiB
#20 Accepted 7ms 7.316 MiB
#21 Accepted 8ms 7.23 MiB
#22 Accepted 22ms 7.914 MiB
#23 Accepted 22ms 8.066 MiB
#24 Accepted 24ms 8.125 MiB
#25 Accepted 40ms 8.566 MiB
#26 Accepted 18ms 8.012 MiB
#27 Accepted 9ms 7.438 MiB
#28 Accepted 24ms 7.906 MiB
#29 Accepted 25ms 8.219 MiB
#30 Accepted 29ms 8.773 MiB
#31 Accepted 33ms 8.273 MiB
#32 Accepted 31ms 8.645 MiB
#33 Accepted 26ms 8.496 MiB
#34 Accepted 29ms 8.316 MiB
#35 Accepted 30ms 8.941 MiB

Code

#include<bits/stdc++.h>
using namespace std;
const long long M=3e5+10,MOD=1000000007;
typedef long long ll;
int vis[M];
vector<int>edge[M];
vector<int>vec;
void dfs(int x){
	vis[x]=1;
	vec.push_back(x);
	for(int i:edge[x]){
		if(!vis[i]){
			dfs(i);
		}
	}
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
    	int n,k;
    	cin>>n>>k;
    	int x=n+1,y=0;
    	vector<int>a(n);
    	for(auto &i:a)cin>>i;
    	vector<int>d=a;
    	sort(d.begin(),d.end());
    	for(int i=0;i<n;i++){
    		if(d[i]!=a[i]){
    			x=min(x,i);
    			y=max(y,i);
    		}
    	}
    	if(x>y){
    		cout<<"YES\n";
    		cout<<1<<" "<<1<<"\n";
    		return 0;
    	}
    	if(y-x+1>k){
    		cout<<"NO\n";
    		return 0;
    	}
    	cout<<"YES\n";
    	cout<<x+1<<" "<<y+1<<"\n";
    	
    
    
    
    
    
}

    
    return 0;
 
}

Information

Submit By
Type
Submission
Problem
P1120 Stairway to the Skyline
Contest
Lockout contest round-1 ( Araf al jami vs Kamonasish Roy)
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 15:40:22
Judged At
2024-11-11 02:34:28
Judged By
Score
100
Total Time
40ms
Peak Memory
8.941 MiB