# 題目
AP325 Q-4-19. 五嶽盟主的會議場所
# 解題思路
目前沒東西...
# 程式碼
#include<bits/stdc++.h> | |
using namespace std; | |
#define Rabbir_Reaper ios_base::sync_with_stdio(0); cin.tie(0); | |
struct mstt{ | |
int s,t,m; | |
}; | |
bool cmp(mstt a,mstt b){ | |
return a.s<b.s; | |
} | |
vector<mstt> sect; | |
priority_queue<pair<int,int>> pq; | |
int sum=0,mx=0; | |
int main(){ | |
int n; | |
cin>>n; | |
for(int i=0,m,s,t;i<n;i++){ | |
cin>>m>>s>>t; | |
sect.push_back({s,t,m}); | |
} | |
sort(sect.begin(),sect.end(),cmp); | |
for(int i=0;i<n;i++){ | |
while(!pq.empty() && -pq.top().first < sect[i].s){ | |
sum -= pq.top().second; | |
pq.pop(); | |
} | |
sum += sect[i].m; | |
pq.push({-sect[i].t,sect[i].m}); | |
mx = max(mx,sum); | |
} | |
cout<<mx; | |
} |