# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
204529 |
2020-02-26T08:46:22 Z |
Saboon |
Hotel (CEOI11_hot) |
C++14 |
|
1315 ms |
46392 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
pair<int,int> offer[maxn];
int main(){
ios_base::sync_with_stdio(false);
int n, m, o;
cin >> n >> m >> o;
multiset<pair<int,int> > room;
for (int i = 0; i < n; i++){
int p, c;
cin >> p >> c;
room.insert({c, p});
}
for (int i = 0; i < m; i++){
int v, d;
cin >> v >> d;
offer[i] = {v, d};
}
sort(offer, offer + m);
reverse(offer, offer + m);
vector<int> vals;
for (int i = 0; i < m; i++){
auto it = room.lower_bound({offer[i].second, 0});
if (it == room.end())
continue;
vals.push_back(offer[i].first - it->second);
room.erase(it);
}
sort(vals.rbegin(), vals.rend());
ll sum = 0;
for (int i = 0; i < min((int)vals.size(), o); i++)
sum += max(0, vals[i]);
cout << sum << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
54 ms |
2940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
109 ms |
4960 KB |
Output is correct |
2 |
Correct |
74 ms |
6008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
349 ms |
12400 KB |
Output is correct |
2 |
Correct |
158 ms |
10484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
813 ms |
24428 KB |
Output is correct |
2 |
Correct |
1000 ms |
24556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
985 ms |
30144 KB |
Output is correct |
2 |
Correct |
1094 ms |
29956 KB |
Output is correct |
3 |
Correct |
1315 ms |
46392 KB |
Output is correct |