TLE,HELP,玄关
查看原帖
TLE,HELP,玄关
840059
tongtong2012楼主2024/9/22 20:59
#include<bits/stdc++.h>
using namespace std;
struct tmd{
	int id;
	int x;
}a[9999999];
int n,T;
bool cmp(tmd sx,tmd sy){
	return sx.x<sy.x;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>T;
	for(int i=1;i<=n;i++){cin>>a[i].x;a[i].id=i;}
	while(T--){
		int s;
		cin>>s;
		if(s==1){
			int ta,tb;
			cin>>ta>>tb;
			a[ta].x=tb;
		}
		else{
			int t;
			cin>>t;
			tmd b[n+1];
			memcpy(b,a,sizeof(struct tmd)*n);
			sort(b+1,b+1+n,cmp);
			for(int i=1;i<=n;i++)if(b[i].id==t)cout<<i<<'\n';
		}
	}
	return 0;
} 

暴力万睡!

2024/9/22 20:59
加载中...