1 条题解

  • 0
    @ 2026-10-6 9:32:22
    #include<bits/stdc++.h>
    using namespace std;
    priority_queue<int,vector<int>,greater<int> > q;
    priority_queue<int,vector<int>,less<int> > p;
    int main(){
    	int n,w,x;
    	cin>>n>>w;
    	for(int i=1;i<=n;i++){
    		cin>>x;
    		int m=max(1,i*w/100);
    		if(q.empty()||x>q.top()) q.push(x);
    		else p.push(x);
    		while(q.size()>m){
    			p.push(q.top());
    			q.pop();
    		}
    		while(q.size()<m){
    			q.push(p.top());
    			p.pop();
    		}
    		cout<<q.top()<<' ';
    	}
    	return 0;
    }
    
    
    • 1

    信息

    ID
    6
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    97
    已通过
    18
    上传者