# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
211808 |
2020-03-21T11:00:20 Z |
AdrianIurian |
Hotel (CEOI11_hot) |
C++14 |
|
2001 ms |
34808 KB |
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
const int VAL=500005;
int N, M, NRO, i, j;
int dif[VAL];
long long ANS;
struct camera {
int cost;
int cap;
};
camera C[VAL], A;
bool operator < (const camera &X, const camera &Y) {
if (X.cap != Y.cap)
return X.cap < Y.cap;
return X.cost < Y.cost;
}
multiset <camera> H;
multiset <camera> :: iterator it;
struct oferta {
int pret;
int dim;
};
oferta O[VAL];
bool cmpO(oferta A, oferta B) {
return A.pret>B.pret;
}
int main() {
cin >> N >> M >> NRO;
for (i=1; i<=N; ++i) {
cin >> C[i].cost >> C[i].cap;
H.insert(C[i]);
}
for (i=1; i<=M; ++i)
cin >> O[i].pret >> O[i].dim;
sort(O+1, O+M+1, cmpO);
for (i=1; i<=M; ++i) {
A.cost = 0;
A.cap = O[i].dim;
it = H.upper_bound(A);
if (it == H.end())
continue;
A = *it;
dif[i] = O[i].pret - A.cost;
H.erase(it);
//cout << O[i].pret << " " << A.cost << '\n';
}
sort(dif+1, dif+M+1);
for (i=M; i>M-NRO; --i)
if (dif[i] > 0)
ANS += dif[i];
cout << ANS << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
1276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
128 ms |
4088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
223 ms |
6120 KB |
Output is correct |
2 |
Correct |
156 ms |
5880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
683 ms |
14748 KB |
Output is correct |
2 |
Correct |
322 ms |
9408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1512 ms |
27904 KB |
Output is correct |
2 |
Correct |
1664 ms |
28152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1672 ms |
34552 KB |
Output is correct |
2 |
Correct |
1919 ms |
33760 KB |
Output is correct |
3 |
Correct |
2001 ms |
34808 KB |
Output is correct |