# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
210481 |
2020-03-17T13:48:38 Z |
LorenaMaria |
Hotel (CEOI11_hot) |
C++14 |
|
2101 ms |
46240 KB |
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
int n,m,k;
long long r;
pair <int,int> o[500001];
multiset < pair <int,int> > s;
vector <int> v;
int main()
{ cin>>n>>m>>k;
for(int i=1;i<=n;i++)
{ int c,p;
cin>>c>>p;
s.insert(make_pair(p,c));
}
for(int i=1;i<=m;i++)
cin>>o[i].first>>o[i].second;
sort(o+1,o+m+1);
for(int i=m;i>0;i--)
{ set < pair <int,int > > :: iterator it=s.lower_bound(make_pair(o[i].second,0));
if(it==s.end())
continue;
if(o[i].first>(*it).second)
{ v.push_back(o[i].first-(*it).second);
s.erase(it);
}
}
sort(v.rbegin(),v.rend());
if(k>v.size())
k=v.size();
for(int i=0;i<k;i++)
r+=1LL*v[i];
cout<<r<<'\n';
return 0;
}
Compilation message
hot.cpp: In function 'int main()':
hot.cpp:31:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(k>v.size())
~^~~~~~~~~
# |
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 |
380 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 |
30 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
127 ms |
4232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
7288 KB |
Output is correct |
2 |
Correct |
156 ms |
5880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
710 ms |
15228 KB |
Output is correct |
2 |
Correct |
314 ms |
10360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1545 ms |
26800 KB |
Output is correct |
2 |
Correct |
1664 ms |
37704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1735 ms |
32240 KB |
Output is correct |
2 |
Correct |
1951 ms |
31356 KB |
Output is correct |
3 |
Correct |
2101 ms |
46240 KB |
Output is correct |