# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
229495 |
2020-05-04T19:31:21 Z |
anayk |
Hotel (CEOI11_hot) |
C++14 |
|
1694 ms |
58744 KB |
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#define int long long
signed main()
{
int n, m, o;
std::cin >> n >> m >> o;
std::vector<std::pair<int, int> > rooms(n);
for(int i = 0; i < n; i++) {
std::cin >> rooms[i].second >> rooms[i].first;
}
std::vector<std::pair<int, int> > cust(m);
for(int i = 0; i < m; i++) {
std::cin >> cust[i].second >> cust[i].first;
}
std::sort(cust.begin(), cust.end());
std::sort(rooms.begin(), rooms.end());
std::multiset<int> avail;
std::multiset<int> cand;
int j = 0;
for(int i = 0; i < n; i++) {
while(j < m && cust[j].first <= rooms[i].first) {
avail.insert(-cust[j].second);
j++;
}
if(!avail.empty()) {
cand.insert((*avail.begin()) + rooms[i].second);
avail.erase(avail.begin());
}
}
int ans = 0;
while(!cand.empty() && o > 0) {
if(*cand.begin() >= 0)
break;
ans -= *cand.begin();
cand.erase(cand.begin());
o--;
}
std::cout << ans << std::endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
3448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
213 ms |
5772 KB |
Output is correct |
2 |
Correct |
139 ms |
3964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
622 ms |
16120 KB |
Output is correct |
2 |
Correct |
348 ms |
14332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1325 ms |
31880 KB |
Output is correct |
2 |
Correct |
1324 ms |
47096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1516 ms |
39304 KB |
Output is correct |
2 |
Correct |
1694 ms |
58744 KB |
Output is correct |
3 |
Correct |
1573 ms |
55928 KB |
Output is correct |