/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 320.0 KiB
#2 Wrong Answer 2ms 320.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
using ll=long long int;

void show(auto x){ cout<<x<<"\n";}
void show1(auto v){ ll n=(signed)v.size();for(int i=0;i<n;i++){cout<<v[i]<<" ";}cout<<"\n";}
void show2(auto v){ ll n=(signed)v.size();for(int i=0;i<n;i++){	cout<<v[i]<<"\n";}}

int main()
{
	ll n;cin>>n;
	
	vector<ll> v(n+1);
	
	for(int i=1;i<=n;i++)
	{
		cin>>v[i];
	}
	
	
	ll q;cin>>q;
	
	while(q--)
	{
		ll x;cin>>x;
		
		if(x==1)
		{
			ll index,val;
			
			v[index]=val;
				
		}
		else
		{
			ll l,r;cin>>l>>r;
			
			vector<ll> arr;
			
			for(int i=l;i<=r;i++)
			{
				arr.push_back(v[i]);
			}
			
			vector<ll> temp=arr;
			
			sort(arr.begin(),arr.end());
			
			if(arr==temp)
			{
				show("YES");
			}
			else
			{
				show("NO");
			}
		}
	}
}

Information

Submit By
Type
Submission
Problem
P1085 Sorted or !Sorted
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-24 09:11:56
Judged At
2024-11-11 03:05:41
Judged By
Score
0
Total Time
2ms
Peak Memory
320.0 KiB