# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
210477 |
2020-03-17T13:41:18 Z |
LorenaMaria |
Hotel (CEOI11_hot) |
C++14 |
|
1559 ms |
39788 KB |
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
int n,m,k,r;
pair <int,int> o[500001];
set < 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+=v[i];
cout<<r<<'\n';
return 0;
}
Compilation message
hot.cpp: In function 'int main()':
hot.cpp:30: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 |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
1144 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
126 ms |
4344 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
227 ms |
7160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
706 ms |
20080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1559 ms |
39788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1536 ms |
33284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |