# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
530563 | FelipeH | Hotel (CEOI11_hot) | C++14 | 746 ms | 19228 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
vector<int> roomSize, roomCost;
vector<pii> offer;
int main(){
int n, m, o; cin >> n >> m >> o;
for(int i = 0;i<n;i++){
int a, b; cin >> a >> b;
roomCost.push_back(a); roomSize.push_back(b);
}
sort(roomCost.begin(),roomCost.end());
sort(roomSize.begin(),roomSize.end());
for(int i = 0;i<m;i++){
int a, b; cin >> a >> b;
offer.push_back(make_pair(a,b));
}
sort(offer.begin(),offer.end());
int resp = 0;
for(int i = offer.size() - 1; i >= 0 && offer.size() - i <= o; i--){
int roomId = lower_bound(roomSize.begin(), roomSize.end(), offer[i].second) - roomSize.begin();
resp += offer[i].first - roomCost[roomId];
roomCost.erase(roomCost.begin() + roomId); roomSize.erase(roomSize.begin() + roomId);
}
cout << resp << "\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |