Pagini recente » Borderou de evaluare (job #453670) | Cod sursa (job #659654) | Cod sursa (job #387405) | Cod sursa (job #240446) | Cod sursa (job #3267277)
#include <bits/stdc++.h>
using namespace std;
#define TITLE "lupu"
ifstream f (TITLE".in");
ofstream g (TITLE".out");
int main()
{
int n,x,l;
f>>n>>x>>l;
priority_queue<pair<int,int>> PQ;
for(int i=1;i<=n; i++)
{
int a,b;
f>>a>>b;
PQ.push({b,(x-a)/l+1});
}
int Ans=0;
for(int i=1; !PQ.empty(); PQ.pop())
{
if(PQ.top().second>=i)
{
i++;
Ans+=PQ.top().first;
}
}
g<<Ans;
return 0;
}