# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
727497 |
2023-04-20T21:18:04 Z |
beaconmc |
Hotel (CEOI11_hot) |
C++14 |
|
3066 ms |
83372 KB |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
//{capacity, cost}
vector<vector<ll>> stuff;
vector<ll> profit;
int main(){
ll n,m,o;
cin >> n >> m >> o;
FOR(i,0,n){
ll a,b;
cin >> a >> b;
stuff.push_back({b,1,a});
}
FOR(i,0,m){
ll a,b;
cin >> a >> b;
stuff.push_back({b,0,a});
}
sort(stuff.begin(), stuff.end());
ll cur = 0;
FOR(i,0,stuff.size()){
if (i!=0 && stuff[i][2] != stuff[i-1][2]){
cur++;
}
stuff[i][0] = cur;
}
sort(stuff.begin(), stuff.end());
reverse(stuff.begin(), stuff.end());
for (auto&i : stuff){
cout << i[0] << " " << i[1] << " " << i[2]<< endl;
}
cout << endl;
multiset<ll> idk;
for (auto&i : stuff){
if (i[1] == 0 && idk.size() > 0){
profit.push_back(i[2]-(*idk.begin()));
idk.erase(*idk.begin());
}else if (i[1] == 1){
idk.insert(i[2]);
}
}
sort(profit.begin(), profit.end());
reverse(profit.begin(), profit.end());
ll ans = 0;
FOR(i,0,min((ll) o, (ll) profit.size())){
ans += max(profit[i],(ll) 0);
}
cout << ans;
}
Compilation message
hot.cpp: In function 'int main()':
hot.cpp:8:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
8 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
32 | FOR(i,0,stuff.size()){
| ~~~~~~~~~~~~~~~~
hot.cpp:32:3: note: in expansion of macro 'FOR'
32 | FOR(i,0,stuff.size()){
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
2060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
260 ms |
8432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
411 ms |
14864 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1210 ms |
40872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2508 ms |
75280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3066 ms |
83372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |