Pagini recente » Borderou de evaluare (job #1330984) | Cod sursa (job #768297) | Cod sursa (job #309118) | Cod sursa (job #3249455) | Cod sursa (job #635204)
Cod sursa(job #635204)
#include <fstream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
ifstream in("gutui.in");
ofstream out("gutui.out");
const int N=100001;
int n,height,u,offset,rez,maxg;
priority_queue< pair<int,int> > heap;
int main(){
int i,x,y;
in>>n>>height>>u;
for(i=1;i<=n;++i){
in>>x>>y;
heap.push(make_pair(y,x));
}
for(i=1;i<=n;i++){
if(heap.top().second+offset<=height){
rez+=heap.top().first;
}
heap.pop();
}
out<<rez;
return 0;
}