lizhuorong @ 2024-07-09 15:52:44
#include<bits/stdc++.h>
using namespace std;
set<int>s;
int main(){
set<int>::iterator it;
int n;
cin>>n;
for(int i=1;i<=n;i++){
int x;
cin>>x;
s.insert(x);
if(i%2==1){
int k=0;
for(it=s.begin();it!=s.end();it++ ){
k++;
if(k==(i+1)/2) cout<<*it<<endl;
}
}
}
}
by Maisie586_ @ 2024-07-09 16:03:04
@lizhuorong 要用vector或者根堆(求关
by lizhuorong @ 2024-07-09 16:11:24
@Maisie586_ 谢谢!
by tzhengqing @ 2024-07-09 16:43:41
n方怕是要T
by tzhengqing @ 2024-07-09 16:44:05
改成nlogn就行