# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
743272 |
2023-05-17T09:20:17 Z |
Dan4Life |
Hotel (CEOI11_hot) |
C++17 |
|
1820 ms |
58768 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(a) (int)a.size()
const int mxN = (int)5e5+10;
using ar = array<int,2>;
ar a[mxN];
int n, m, k, x, y;
int32_t main(){
cin >> n >> m >> k; multiset<pair<int,int>> Ms;
for(int i = 0; i < n; i++) cin >> x >> y, Ms.insert({y,x});
for(int i = 0; i < m; i++) cin >> a[i][0] >> a[i][1];
multiset<int,greater<>> S; int ans = 0; sort(a,a+m);
for(int i = m-1; i >= 0; i--){
auto itr=Ms.lower_bound({a[i][1],0});
if(itr!=end(Ms) and itr->second < a[i][0])
S.insert(a[i][0]-itr->second), Ms.erase(itr);
}
while(k-- and sz(S)) ans+=max(0ll,*begin(S)), S.erase(begin(S));
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
4920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
198 ms |
8456 KB |
Output is correct |
2 |
Correct |
110 ms |
7020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
657 ms |
19620 KB |
Output is correct |
2 |
Correct |
265 ms |
12764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1266 ms |
35148 KB |
Output is correct |
2 |
Correct |
1239 ms |
47008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1413 ms |
42976 KB |
Output is correct |
2 |
Correct |
1646 ms |
58768 KB |
Output is correct |
3 |
Correct |
1820 ms |
55948 KB |
Output is correct |