#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' <<
#define nl << '\n'
signed main(){
cin.tie(0)->sync_with_stdio(0);
int n, m, o; cin >> n >> m >> o;
array<int, 2> offers[m], room;
set<array<int, 2>> rooms;
for(int i=0; i<n; ++i){
cin >> room[1] >> room[0];
rooms.insert(room);
}
for(auto &i : offers) cin >> i[0] >> i[1], i[1] = -i[1];
sort(offers, offers+m, greater<>());
vector<int> pos;
for(auto &i : offers){
auto f = rooms.lower_bound({-i[1], 0});
if(f != rooms.end()){
pos.push_back(i[0] - (*f)[1]);
rooms.erase(f);
}
}
sort(pos.begin(), pos.end(), greater<>());
cout << accumulate(pos.begin(), pos.begin()+o, 0LL);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
5652 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
129 ms |
9704 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
373 ms |
25952 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
845 ms |
51460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
681 ms |
42432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |