hackTLE
查看原帖
hackTLE
836448
stylus楼主2024/8/22 17:22

rt,求调

#include<bits/stdc++.h>
#define int long long
/*
不要以为你有后台你就可以乱看人代码,不要以为你有后台就乱来看别人。你没有代码!!!你,就是后台享有最高权力,你认为我是骂你的,你就抄吧,你甚至可以封我的号。但是,群众的眼睛是雪亮的!!!!
如果你看了我的代码,会让全天下的oiers知道,你的腐朽!!!
你将会臭名昭著!!!
*/
using namespace std;
void read(int &x){
	x=0;bool f=0;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-')f=1;
		ch=getchar();
	}do{x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}while(ch>='0'&&ch<='9');
	x=f?-x:x;
}
int n,op,x,l,a[10001];
signed main(){
	read(n);
	while(n--){
		read(op),read(x);
		if(op==1)cout<<lower_bound(a,a+l,x)-a+1<<endl;
		if(op==2)cout<<a[x-1]<<endl;
		if(op==3){
			int i=lower_bound(a,a+l,x)-a;
			if(a[i-1]>=x)cout<<"-2147483647\n";
			else cout<<a[i-1]<<endl;
		}if(op==4){
			int i=upper_bound(a,a+l,x)-a;
			if(a[i]<=x)cout<<"2147483647\n";
			else cout<<a[i]<<endl;
		}if(op==5)a[l++]=x,sort(a,a+l);
	}
	return 0;
}
2024/8/22 17:22
加载中...