Cod sursa(job #3267277)
| Utilizator | Data | 11 ianuarie 2025 10:41:31 | |
|---|---|---|---|
| Problema | Lupul Urias si Rau | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#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;
}
