1 条题解

  • 0
    @ 2022-8-25 10:27:17
    #include<cstdio>
    #include<algorithm>
    #include<set>
    #include<map>
    using namespace std;
    typedef long long LL;
    #define int LL
    typedef multiset<int>::iterator Site;
    struct tw{
    	int out,in,b;
    	bool operator < (tw q) const {return b>q.b;}
    }wa[200005];
    multiset<int> Set;
    signed main(){
    	int n,ans=0;
    	scanf("%lld",&n);
    	for(int i=1;i<=n;++i)
    	{
    		scanf("%lld %lld %lld",&wa[i].out,&wa[i].in,&wa[i].b);
    		ans+=wa[i].in*wa[i].b;
    		Set.insert(wa[i].out);
    	}
    	sort(wa+1,wa+1+n);
    	for(int i=1;i<=n;++i)
    	{
    		Site it=Set.lower_bound(wa[i].in);
    		if(it!=Set.begin())	ans-=(*--it)*wa[i].b,Set.erase(it);
    	}
    	printf("%lld",ans);
    	return 0;
    }
    
    • 1

    信息

    ID
    4482
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    2
    已通过
    2
    上传者