# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
211801 |
2020-03-21T10:17:59 Z |
MarcVana |
Hotel (CEOI11_hot) |
C++14 |
|
2003 ms |
53060 KB |
#include <iostream>
#include <algorithm>
#include <set>
#define NMAX 500005
using namespace std;
int N, M, NRO;
int DIFF[NMAX];
long long ANS;
struct room
{
int cost, capacity;
} C[NMAX], A;
multiset <room> H;
multiset <room> :: iterator it;
bool operator < (const room &X, const room &Y)
{
if (X.capacity != Y.capacity)
return X.capacity < Y.capacity;
return X.cost < Y.cost;
}
struct offer
{
int price, dimension;
} O[NMAX];
bool cmpO(offer A, offer B)
{
return A.price>B.price;
}
int main()
{
cin >> N >> M >> NRO;
for (int i=1; i<=N; i++)
{
cin >> C[i].cost >> C[i].capacity;
H.insert(C[i]);
}
for (int i=1; i<=M; i++)
cin >> O[i].price >> O[i].dimension;
sort(O+1, O+M+1, cmpO);
for (int i=1; i<=M; i++)
{
A.cost=0;
A.capacity=O[i].dimension;
it=H.upper_bound(A);
if (it==H.end())
continue;
A=*it;
DIFF[i]=O[i].price-A.cost;
H.erase(it);
}
sort(DIFF+1, DIFF+M+1);
for (int i=M; i>M-NRO; i--)
if (DIFF[i]>0)
ANS+=DIFF[i];
cout << ANS;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 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 |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
128 ms |
2960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
232 ms |
5112 KB |
Output is correct |
2 |
Correct |
156 ms |
6392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
718 ms |
13732 KB |
Output is correct |
2 |
Correct |
321 ms |
11384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1510 ms |
27084 KB |
Output is correct |
2 |
Correct |
1703 ms |
42616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1703 ms |
33748 KB |
Output is correct |
2 |
Correct |
1976 ms |
53060 KB |
Output is correct |
3 |
Correct |
2003 ms |
50064 KB |
Output is correct |