# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
530569 |
2022-02-25T20:42:41 Z |
FelipeH |
Hotel (CEOI11_hot) |
C++14 |
|
789 ms |
16640 KB |
#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, cnt = 0;
for(int i = offer.size() - 1; i >= 0 && cnt <= o; i--){
if(roomCost.empty()) break;
// printf("processing offer (%d,%d)\n",offer[i].first, offer[i].second);
int roomId = lower_bound(roomSize.begin(), roomSize.end(), offer[i].second) - roomSize.begin();
if(roomId >= n) continue;
// printf("-chose room %d (%d,%d)\n",roomId, roomCost[roomId], roomSize[roomId]);
if(offer[i].first - roomCost[roomId] > 0){
resp += offer[i].first - roomCost[roomId];
roomCost.erase(roomCost.begin() + roomId); roomSize.erase(roomSize.begin() + roomId);
cnt++;
}
}
cout << resp << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
1228 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
68 ms |
2152 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
129 ms |
3304 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
366 ms |
7568 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
733 ms |
14496 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
789 ms |
16640 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |