80分TLE求调
查看原帖
80分TLE求调
1398455
封禁用户楼主2025/1/17 17:25
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100001],n,t,q;
bool cmp(ll x,ll y)
{
	return x>y;
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>t;
	for(ll i=1;i<=n;i++)cin>>a[i];
	while(t--)
	{
		ll op,l,r;
		cin>>op>>l>>r;
		if(op)sort(a+l,a+r+1,cmp);
		else sort(a+l,a+r+1);
	}
	cin>>q;
	cout<<a[q];
}
2025/1/17 17:25
加载中...