# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
546326 |
2022-04-07T09:20:21 Z |
blue |
Hotel (CEOI11_hot) |
C++17 |
|
598 ms |
39428 KB |
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, o;
cin >> n >> m >> o;
multiset<pll> rooms; //(capacity, upkeep)
for(int i = 1; i <= n; i++)
{
ll c, p;
cin >> c >> p;
rooms.insert({p, c});
}
vector<pll> offers(m); //(capacity requirement = first, gain = second)
for(int j = 0; j < m; j++)
{
cin >> offers[j].second >> offers[j].first;
}
sort(offers.begin(), offers.end(), [] (pll U, pll V)
{
return U.second > V.second;
});
ll res = 0;
int accepted = 0;
for(pll z : offers)
{
if(accepted == o) break;
ll capreq = z.first;
ll gain = z.second;
auto f = rooms.lower_bound({capreq, -1});
if(f == rooms.end()) continue;
if(gain > f->second)
{
res += gain - f->second;
accepted++;
}
rooms.erase(f);
}
cout << res << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
3336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
5740 KB |
Output is correct |
2 |
Incorrect |
62 ms |
5264 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
247 ms |
15948 KB |
Output is correct |
2 |
Incorrect |
99 ms |
9628 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
488 ms |
31492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
598 ms |
39428 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |