# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
875436 |
2023-11-19T16:57:57 Z |
ElenaBM |
Hotel (CEOI11_hot) |
C++17 |
|
673 ms |
29836 KB |
#include <bits/stdc++.h>
#define x first
#define y second
#define int long long
using namespace std;
signed main()
{
int n, m, o, ans = 0;
cin>> n>> m>> o;
vector<pair<int,int>>room(n), off(m);
priority_queue <int>best;
vector<int>prov(n,0);
for(int i = 0; i <n; ++i)cin>> room[i].x >> room[i].y;
for (int i = 0; i <m; ++i)cin>> off[i].y>> off[i].x;
sort(room.begin(), room.end());
sort(off.begin(), off.end());
int snd = 0;
for (int i = 0; i < n; ++i){
int mx = room[i].y;
for (int j = snd; j < m; ++j){
if (j == m -1)snd = m;
if (off[j].x <= mx){
best.push(off[j].y);
}
else{
snd = j;
break;
}
}
if (!best.empty()){
int s = 0;
prov[i] = max(s, best.top()-room[i].x);
best.pop();
}
}
sort(prov.begin(), prov.end(), greater());
for (int i = 0; i < o; ++i) ans += prov[i];
cout<< ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
66 ms |
3052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
4688 KB |
Output is correct |
2 |
Correct |
63 ms |
3720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
268 ms |
12348 KB |
Output is correct |
2 |
Correct |
151 ms |
8788 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
569 ms |
24080 KB |
Output is correct |
2 |
Correct |
550 ms |
24020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
617 ms |
29064 KB |
Output is correct |
2 |
Correct |
673 ms |
29836 KB |
Output is correct |
3 |
Correct |
603 ms |
28240 KB |
Output is correct |