Submission #385243

# Submission time Handle Problem Language Result Execution time Memory
385243 2021-04-03T19:30:03 Z ritul_kr_singh Hotel (CEOI11_hot) C++17
20 / 100
1028 ms 63028 KB
#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;
	multiset<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];
	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 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 4208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 7016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 349 ms 18272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 795 ms 35932 KB Output is correct
2 Incorrect 987 ms 51520 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 911 ms 43868 KB Output is correct
2 Incorrect 1028 ms 63028 KB Output isn't correct
3 Halted 0 ms 0 KB -