第7个测试点WA了,求大佬ヽ( ̄ω ̄( ̄ω ̄〃)ゝ

P8661 [蓝桥杯 2018 省 B] 日志统计

UESTCxx @ 2024-01-25 18:28:44

#include<bits/stdc++.h>
using namespace std;
multimap<int,int>hahash;
struct cmp{  
    bool operator()(const pair<int, int>& a, const std::pair<int, int>& b) {  
        if (a.first == b.first) {  
            return a.second > b.second;
        }  
        return a.first > b.first;
    }  
}; 
set<int>ans;
priority_queue<pair<int,int>,vector<pair<int, int>>,cmp>heheap;
int main(){
    ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
    int n,d,k;cin>>n>>d>>k;

    for(int i=0;i<n;++i){ 
        int time,index;
        cin>>time>>index;
        heheap.push(make_pair(index,time));
    }

    while(!heheap.empty()){
        int time=heheap.top().second+d;
        int index=heheap.top().first;
        int counter=1;
        heheap.pop();
        while(!heheap.empty()&&heheap.top().first==index&&heheap.top().second<time){
            heheap.pop();++counter;
        }
        if(counter>=k)ans.insert(index);
    }
    for(const auto& x:ans)cout<<x<<endl;
    return 0;
}

第七个测试点WA了是为什么啊???大佬看看


by xxxxxzy @ 2024-01-25 18:33:54

洛谷好像出Bug了


by UESTCxx @ 2024-01-25 18:41:39

@C20252323tzy 什么意思呀


by xiaoshumiao @ 2024-01-25 18:42:29

@UESTCxx 看主页。


by xiaoshumiao @ 2024-01-25 18:42:43

标题没了。


by UESTCxx @ 2024-01-25 18:45:48

...SOS


by UESTCxx @ 2024-01-25 21:30:35

是窗口更新问题,现在解决了,谢谢大家(●'◡'●) @UESTCxx


|