# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
597574 |
2022-07-16T10:39:55 Z |
hail |
Hotel (CEOI11_hot) |
C++17 |
|
4000 ms |
23400 KB |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
bool or_sor(pair<ll, ll> a, pair<ll, ll> b)
{
if(a.first==b.first) return a.second<b.second;
else return a.first>b.first;
}
void solve()
{
ll n, m, o;
cin>>n>>m>>o;
vector<pair<ll, ll>> rooms(n);
// cap upkeep
vector<pair<ll,ll>> orders(m);
// rent mincap
for(int i=0; i<n; i++)
{
cin>>rooms[i].second>>rooms[i].first;
}
for(int i=0; i<m; i++)
{
cin>>orders[i].first>>orders[i].second;
}
sort(rooms.begin(), rooms.end());
sort(orders.begin(), orders.end(), or_sor);
vector<ll> max_prof(min(n, m));
pair<ll, ll> ord;
auto it=rooms.begin();
for(ll i=0; i<min(m, n); i++)
{
ord=orders[i];
it = lower_bound(rooms.begin(), rooms.end(), make_pair(ord.second, (ll) 0));
max_prof[i]=ord.first-(*it).second;
rooms.erase(it);
}
sort(max_prof.begin(), max_prof.end());
ll ans{};
for(int i=0; i<o; i++)
{
if(max_prof[i]<=0) break;
ans+=max_prof[i];
}
cout<<ans;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;
while(t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
362 ms |
3420 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
954 ms |
5748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4019 ms |
11776 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4078 ms |
19564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4038 ms |
23400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |