/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 512.0 KiB
#2 Accepted 2ms 320.0 KiB
#3 Time Exceeded ≥2083ms ≥5.602 MiB
#4 Time Exceeded ≥2092ms ≥5.594 MiB

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;
			cin>>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:19:58
Judged At
2024-11-11 03:05:39
Judged By
Score
20
Total Time
≥2092ms
Peak Memory
≥5.602 MiB