Pagini recente » Cod sursa (job #2591221) | Cod sursa (job #144935) | Cod sursa (job #3172713) | Cod sursa (job #3167649) | Cod sursa (job #2907679)
/// [A][M][C][B][N] ///
#include <bits/stdc++.h>
using namespace std;
const int mod = 9901, inf = 0x3f3f3f3f;
const char sp = ' ', nl = '\n';
ifstream fin("lupu.in");
ofstream fout("lupu.out");
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n, x, l;
fin >> n >> x >> l;
priority_queue<pair<int, int> > pq;
for (int i = 0; i < n; ++i) {
pair<int, int> foo;
fin >> foo.second >> foo.first;
pq.push(foo);
}
long long cost = 0;
while (pq.size()) {
pair<int, int> t = pq.top();
pq.pop();
if (t.second > x) {
continue;
}
cost += t.first;
x -= l;
}
fout << cost;
}